diff options
Diffstat (limited to 'deps/v8/src/ppc/macro-assembler-ppc.h')
-rw-r--r-- | deps/v8/src/ppc/macro-assembler-ppc.h | 147 |
1 files changed, 81 insertions, 66 deletions
diff --git a/deps/v8/src/ppc/macro-assembler-ppc.h b/deps/v8/src/ppc/macro-assembler-ppc.h index d4660d9207..78de89aa5c 100644 --- a/deps/v8/src/ppc/macro-assembler-ppc.h +++ b/deps/v8/src/ppc/macro-assembler-ppc.h @@ -24,6 +24,7 @@ const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_r15}; const Register kInterpreterBytecodeArrayRegister = {Register::kCode_r16}; const Register kInterpreterDispatchTableRegister = {Register::kCode_r17}; const Register kJavaScriptCallArgCountRegister = {Register::kCode_r3}; +const Register kJavaScriptCallNewTargetRegister = {Register::kCode_r6}; const Register kRuntimeCallFunctionRegister = {Register::kCode_r4}; const Register kRuntimeCallArgCountRegister = {Register::kCode_r3}; @@ -65,7 +66,8 @@ Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg, bool AreAliased(Register reg1, Register reg2, Register reg3 = no_reg, Register reg4 = no_reg, Register reg5 = no_reg, Register reg6 = no_reg, Register reg7 = no_reg, - Register reg8 = no_reg); + Register reg8 = no_reg, Register reg9 = no_reg, + Register reg10 = no_reg); #endif // These exist to provide portability between 32 and 64bit @@ -109,11 +111,8 @@ bool AreAliased(Register reg1, Register reg2, Register reg3 = no_reg, // MacroAssembler implements a collection of frequently used macros. class MacroAssembler : public Assembler { public: - // The isolate parameter can be NULL if the macro assembler should - // not use isolate-dependent functionality. In this case, it's the - // responsibility of the caller to never invoke such function on the - // macro assembler. - MacroAssembler(Isolate* isolate, void* buffer, int size); + MacroAssembler(Isolate* isolate, void* buffer, int size, + CodeObjectRequired create_code_object); // Returns the size of a call in instructions. Note, the value returned is @@ -217,18 +216,10 @@ class MacroAssembler : public Assembler { void JumpIfBlack(Register object, Register scratch0, Register scratch1, Label* on_black); - // Checks the color of an object. If the object is already grey or black - // then we just fall through, since it is already live. If it is white and - // we can determine that it doesn't need to be scanned, then we just mark it - // black and fall through. For the rest we jump to the label so the - // incremental marker can fix its assumptions. - void EnsureNotWhite(Register object, Register scratch1, Register scratch2, - Register scratch3, Label* object_is_white_and_not_data); - - // Detects conservatively whether an object is data-only, i.e. it does need to - // be scanned by the garbage collector. - void JumpIfDataObject(Register value, Register scratch, - Label* not_data_object); + // Checks the color of an object. If the object is white we jump to the + // incremental marker. + void JumpIfWhite(Register value, Register scratch1, Register scratch2, + Register scratch3, Label* value_is_white); // Notify the garbage collector that we wrote a pointer into an object. // |object| is the object being stored into, |value| is the object being @@ -387,8 +378,10 @@ class MacroAssembler : public Assembler { const Register int_scratch); #if V8_TARGET_ARCH_PPC64 - void ConvertInt64ToDouble(Register src, DoubleRegister double_dst); void ConvertInt64ToFloat(Register src, DoubleRegister double_dst); + void ConvertInt64ToDouble(Register src, DoubleRegister double_dst); + void ConvertUnsignedInt64ToFloat(Register src, DoubleRegister double_dst); + void ConvertUnsignedInt64ToDouble(Register src, DoubleRegister double_dst); #endif // Converts the double_input to an integer. Note that, upon return, @@ -400,9 +393,18 @@ class MacroAssembler : public Assembler { const Register dst, const DoubleRegister double_dst, FPRoundingMode rounding_mode = kRoundToZero); +#if V8_TARGET_ARCH_PPC64 + // Converts the double_input to an unsigned integer. Note that, upon return, + // the contents of double_dst will also hold the fixed point representation. + void ConvertDoubleToUnsignedInt64( + const DoubleRegister double_input, const Register dst, + const DoubleRegister double_dst, + FPRoundingMode rounding_mode = kRoundToZero); +#endif + // Generates function and stub prologue code. - void StubPrologue(int prologue_offset = 0); - void Prologue(bool code_pre_aging, int prologue_offset = 0); + void StubPrologue(Register base = no_reg, int prologue_offset = 0); + void Prologue(bool code_pre_aging, Register base, int prologue_offset = 0); // Enter exit frame. // stack_space - extra stack space, used for parameters before call to C. @@ -421,8 +423,15 @@ class MacroAssembler : public Assembler { void LoadContext(Register dst, int context_chain_length); + // Load the global object from the current context. + void LoadGlobalObject(Register dst) { + LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); + } + // Load the global proxy from the current context. - void LoadGlobalProxy(Register dst); + void LoadGlobalProxy(Register dst) { + LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); + } // Conditionally load the cached Array transitioned map of type // transitioned_kind from the native context if the map in register @@ -434,7 +443,7 @@ class MacroAssembler : public Assembler { Register scratch, Label* no_map_match); - void LoadGlobalFunction(int index, Register function); + void LoadNativeContextSlot(int index, Register dst); // Load the initial map from the global function. The registers // function and map can be the same, function is then overwritten. @@ -542,14 +551,20 @@ class MacroAssembler : public Assembler { // JavaScript invokes // Invoke the JavaScript function code by either calling or jumping. - void InvokeCode(Register code, const ParameterCount& expected, - const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper); + void InvokeFunctionCode(Register function, Register new_target, + const ParameterCount& expected, + const ParameterCount& actual, InvokeFlag flag, + const CallWrapper& call_wrapper); + + void FloodFunctionIfStepping(Register fun, Register new_target, + const ParameterCount& expected, + const ParameterCount& actual); // Invoke the JavaScript function in the given register. Changes the // current context to the context in the function before invoking. - void InvokeFunction(Register function, const ParameterCount& actual, - InvokeFlag flag, const CallWrapper& call_wrapper); + void InvokeFunction(Register function, Register new_target, + const ParameterCount& actual, InvokeFlag flag, + const CallWrapper& call_wrapper); void InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, @@ -641,8 +656,8 @@ class MacroAssembler : public Assembler { void Allocate(int object_size, Register result, Register scratch1, Register scratch2, Label* gc_required, AllocationFlags flags); - void Allocate(Register object_size, Register result, Register scratch1, - Register scratch2, Label* gc_required, AllocationFlags flags); + void Allocate(Register object_size, Register result, Register result_end, + Register scratch, Label* gc_required, AllocationFlags flags); void AllocateTwoByteString(Register result, Register length, Register scratch1, Register scratch2, @@ -675,8 +690,11 @@ class MacroAssembler : public Assembler { Register heap_number_map, Label* gc_required); - // Copies a fixed number of fields of heap objects from src to dst. - void CopyFields(Register dst, Register src, RegList temps, int field_count); + // Allocate and initialize a JSValue wrapper with the specified {constructor} + // and {value}. + void AllocateJSValue(Register result, Register constructor, Register value, + Register scratch1, Register scratch2, + Label* gc_required); // Copies a number of bytes from src to dst. All registers are clobbered. On // exit src and dst will point to the place just after where the last byte was @@ -684,17 +702,17 @@ class MacroAssembler : public Assembler { void CopyBytes(Register src, Register dst, Register length, Register scratch); // Initialize fields with filler values. |count| fields starting at - // |start_offset| are overwritten with the value in |filler|. At the end the - // loop, |start_offset| points at the next uninitialized field. |count| is - // assumed to be non-zero. - void InitializeNFieldsWithFiller(Register start_offset, Register count, + // |current_address| are overwritten with the value in |filler|. At the end + // the loop, |current_address| points at the next uninitialized field. + // |count| is assumed to be non-zero. + void InitializeNFieldsWithFiller(Register current_address, Register count, Register filler); - // Initialize fields with filler values. Fields starting at |start_offset| - // not including end_offset are overwritten with the value in |filler|. At - // the end the loop, |start_offset| takes the value of |end_offset|. - void InitializeFieldsWithFiller(Register start_offset, Register end_offset, - Register filler); + // Initialize fields with filler values. Fields starting at |current_address| + // not including |end_address| are overwritten with the value in |filler|. At + // the end the loop, |current_address| takes the value of |end_address|. + void InitializeFieldsWithFiller(Register current_address, + Register end_address, Register filler); // --------------------------------------------------------------------------- // Support functions. @@ -919,29 +937,29 @@ class MacroAssembler : public Assembler { // Call a runtime routine. void CallRuntime(const Runtime::Function* f, int num_arguments, SaveFPRegsMode save_doubles = kDontSaveFPRegs); - void CallRuntimeSaveDoubles(Runtime::FunctionId id) { - const Runtime::Function* function = Runtime::FunctionForId(id); + void CallRuntimeSaveDoubles(Runtime::FunctionId fid) { + const Runtime::Function* function = Runtime::FunctionForId(fid); CallRuntime(function, function->nargs, kSaveFPRegs); } // Convenience function: Same as above, but takes the fid instead. - void CallRuntime(Runtime::FunctionId id, int num_arguments, + void CallRuntime(Runtime::FunctionId fid, + SaveFPRegsMode save_doubles = kDontSaveFPRegs) { + const Runtime::Function* function = Runtime::FunctionForId(fid); + CallRuntime(function, function->nargs, save_doubles); + } + + // Convenience function: Same as above, but takes the fid instead. + void CallRuntime(Runtime::FunctionId fid, int num_arguments, SaveFPRegsMode save_doubles = kDontSaveFPRegs) { - CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles); + CallRuntime(Runtime::FunctionForId(fid), num_arguments, save_doubles); } // Convenience function: call an external reference. void CallExternalReference(const ExternalReference& ext, int num_arguments); - // Tail call of a runtime routine (jump). - // Like JumpToExternalReference, but also takes care of passing the number - // of parameters. - void TailCallExternalReference(const ExternalReference& ext, - int num_arguments, int result_size); - // Convenience function: tail call a runtime routine (jump). - void TailCallRuntime(Runtime::FunctionId fid, int num_arguments, - int result_size); + void TailCallRuntime(Runtime::FunctionId fid); int CalculateStackPassedWords(int num_reg_arguments, int num_double_arguments); @@ -990,13 +1008,6 @@ class MacroAssembler : public Assembler { void InvokeBuiltin(int native_context_index, InvokeFlag flag, const CallWrapper& call_wrapper = NullCallWrapper()); - // Store the code object for the given builtin in the target register and - // setup the function in r1. - void GetBuiltinEntry(Register target, int native_context_index); - - // Store the function for the given builtin in the target register. - void GetBuiltinFunction(Register target, int native_context_index); - Handle<Object> CodeObject() { DCHECK(!code_object_.is_null()); return code_object_; @@ -1317,6 +1328,10 @@ class MacroAssembler : public Assembler { void AssertFunction(Register object); + // Abort execution if argument is not a JSBoundFunction, + // enabled via --debug-code. + void AssertBoundFunction(Register object); + // Abort execution if argument is not undefined or an AllocationSite, enabled // via --debug-code. void AssertUndefinedOrAllocationSite(Register object, Register scratch); @@ -1483,8 +1498,7 @@ class MacroAssembler : public Assembler { // Helper functions for generating invokes. void InvokePrologue(const ParameterCount& expected, - const ParameterCount& actual, Handle<Code> code_constant, - Register code_reg, Label* done, + const ParameterCount& actual, Label* done, bool* definitely_mismatches, InvokeFlag flag, const CallWrapper& call_wrapper); @@ -1531,7 +1545,8 @@ class CodePatcher { public: enum FlushICache { FLUSH, DONT_FLUSH }; - CodePatcher(byte* address, int instructions, FlushICache flush_cache = FLUSH); + CodePatcher(Isolate* isolate, byte* address, int instructions, + FlushICache flush_cache = FLUSH); ~CodePatcher(); // Macro assembler to emit code. @@ -1555,13 +1570,13 @@ class CodePatcher { // ----------------------------------------------------------------------------- // Static helper functions. -inline MemOperand ContextOperand(Register context, int index = 0) { +inline MemOperand ContextMemOperand(Register context, int index = 0) { return MemOperand(context, Context::SlotOffset(index)); } -inline MemOperand GlobalObjectOperand() { - return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); +inline MemOperand NativeContextMemOperand() { + return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX); } |