| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 class MacroAssembler: public Assembler { | 91 class MacroAssembler: public Assembler { |
| 92 public: | 92 public: |
| 93 // The isolate parameter can be NULL if the macro assembler should | 93 // The isolate parameter can be NULL if the macro assembler should |
| 94 // not use isolate-dependent functionality. In this case, it's the | 94 // not use isolate-dependent functionality. In this case, it's the |
| 95 // responsibility of the caller to never invoke such function on the | 95 // responsibility of the caller to never invoke such function on the |
| 96 // macro assembler. | 96 // macro assembler. |
| 97 MacroAssembler(Isolate* isolate, void* buffer, int size); | 97 MacroAssembler(Isolate* isolate, void* buffer, int size); |
| 98 | 98 |
| 99 // Jump, Call, and Ret pseudo instructions implementing inter-working. | 99 // Jump, Call, and Ret pseudo instructions implementing inter-working. |
| 100 void Jump(Register target, Condition cond = al); | 100 void Jump(Register target, Condition cond = al); |
| 101 void Jump(byte* target, RelocInfo::Mode rmode, Condition cond = al); | 101 void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al); |
| 102 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); | 102 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); |
| 103 int CallSize(Register target, Condition cond = al); | 103 int CallSize(Register target, Condition cond = al); |
| 104 void Call(Register target, Condition cond = al); | 104 void Call(Register target, Condition cond = al); |
| 105 int CallSize(byte* target, RelocInfo::Mode rmode, Condition cond = al); | 105 int CallSize(Address target, RelocInfo::Mode rmode, Condition cond = al); |
| 106 void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al); | 106 void Call(Address target, RelocInfo::Mode rmode, Condition cond = al); |
| 107 int CallSize(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); | 107 int CallSize(Handle<Code> code, |
| 108 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
| 109 unsigned ast_id = kNoASTId, |
| 110 Condition cond = al); |
| 108 void Call(Handle<Code> code, | 111 void Call(Handle<Code> code, |
| 109 RelocInfo::Mode rmode, | 112 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
| 110 Condition cond = al); | 113 unsigned ast_id = kNoASTId, |
| 111 void CallWithAstId(Handle<Code> code, | |
| 112 RelocInfo::Mode rmode, | |
| 113 unsigned ast_id, | |
| 114 Condition cond = al); | 114 Condition cond = al); |
| 115 void Ret(Condition cond = al); | 115 void Ret(Condition cond = al); |
| 116 | 116 |
| 117 // Emit code to discard a non-negative number of pointer-sized elements | 117 // Emit code to discard a non-negative number of pointer-sized elements |
| 118 // from the stack, clobbering only the sp register. | 118 // from the stack, clobbering only the sp register. |
| 119 void Drop(int count, Condition cond = al); | 119 void Drop(int count, Condition cond = al); |
| 120 | 120 |
| 121 void Ret(int drop, Condition cond = al); | 121 void Ret(int drop, Condition cond = al); |
| 122 | 122 |
| 123 // Swap two registers. If the scratch register is omitted then a slightly | 123 // Swap two registers. If the scratch register is omitted then a slightly |
| (...skipping 20 matching lines...) Expand all Loading... |
| 144 int width, | 144 int width, |
| 145 Condition cond = al); | 145 Condition cond = al); |
| 146 void Bfc(Register dst, int lsb, int width, Condition cond = al); | 146 void Bfc(Register dst, int lsb, int width, Condition cond = al); |
| 147 void Usat(Register dst, int satpos, const Operand& src, | 147 void Usat(Register dst, int satpos, const Operand& src, |
| 148 Condition cond = al); | 148 Condition cond = al); |
| 149 | 149 |
| 150 void Call(Label* target); | 150 void Call(Label* target); |
| 151 | 151 |
| 152 // Register move. May do nothing if the registers are identical. | 152 // Register move. May do nothing if the registers are identical. |
| 153 void Move(Register dst, Handle<Object> value); | 153 void Move(Register dst, Handle<Object> value); |
| 154 void Move(Register dst, Register src); | 154 void Move(Register dst, Register src, Condition cond = al); |
| 155 void Move(DoubleRegister dst, DoubleRegister src); | 155 void Move(DoubleRegister dst, DoubleRegister src); |
| 156 | 156 |
| 157 // Jumps to the label at the index given by the Smi in "index". | |
| 158 void SmiJumpTable(Register index, Vector<Label*> targets); | |
| 159 // Load an object from the root table. | 157 // Load an object from the root table. |
| 160 void LoadRoot(Register destination, | 158 void LoadRoot(Register destination, |
| 161 Heap::RootListIndex index, | 159 Heap::RootListIndex index, |
| 162 Condition cond = al); | 160 Condition cond = al); |
| 163 // Store an object to the root table. | 161 // Store an object to the root table. |
| 164 void StoreRoot(Register source, | 162 void StoreRoot(Register source, |
| 165 Heap::RootListIndex index, | 163 Heap::RootListIndex index, |
| 166 Condition cond = al); | 164 Condition cond = al); |
| 167 | 165 |
| 168 // --------------------------------------------------------------------------- | 166 // --------------------------------------------------------------------------- |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // address registers are clobbered by the operation. | 276 // address registers are clobbered by the operation. |
| 279 void RecordWrite( | 277 void RecordWrite( |
| 280 Register object, | 278 Register object, |
| 281 Register address, | 279 Register address, |
| 282 Register value, | 280 Register value, |
| 283 LinkRegisterStatus lr_status, | 281 LinkRegisterStatus lr_status, |
| 284 SaveFPRegsMode save_fp, | 282 SaveFPRegsMode save_fp, |
| 285 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, | 283 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, |
| 286 SmiCheck smi_check = INLINE_SMI_CHECK); | 284 SmiCheck smi_check = INLINE_SMI_CHECK); |
| 287 | 285 |
| 286 // Push a handle. |
| 287 void Push(Handle<Object> handle); |
| 288 |
| 288 // Push two registers. Pushes leftmost register first (to highest address). | 289 // Push two registers. Pushes leftmost register first (to highest address). |
| 289 void Push(Register src1, Register src2, Condition cond = al) { | 290 void Push(Register src1, Register src2, Condition cond = al) { |
| 290 ASSERT(!src1.is(src2)); | 291 ASSERT(!src1.is(src2)); |
| 291 if (src1.code() > src2.code()) { | 292 if (src1.code() > src2.code()) { |
| 292 stm(db_w, sp, src1.bit() | src2.bit(), cond); | 293 stm(db_w, sp, src1.bit() | src2.bit(), cond); |
| 293 } else { | 294 } else { |
| 294 str(src1, MemOperand(sp, 4, NegPreIndex), cond); | 295 str(src1, MemOperand(sp, 4, NegPreIndex), cond); |
| 295 str(src2, MemOperand(sp, 4, NegPreIndex), cond); | 296 str(src2, MemOperand(sp, 4, NegPreIndex), cond); |
| 296 } | 297 } |
| 297 } | 298 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // Compare double values and then load the fpscr flags to a register. | 398 // Compare double values and then load the fpscr flags to a register. |
| 398 void VFPCompareAndLoadFlags(const DwVfpRegister src1, | 399 void VFPCompareAndLoadFlags(const DwVfpRegister src1, |
| 399 const DwVfpRegister src2, | 400 const DwVfpRegister src2, |
| 400 const Register fpscr_flags, | 401 const Register fpscr_flags, |
| 401 const Condition cond = al); | 402 const Condition cond = al); |
| 402 void VFPCompareAndLoadFlags(const DwVfpRegister src1, | 403 void VFPCompareAndLoadFlags(const DwVfpRegister src1, |
| 403 const double src2, | 404 const double src2, |
| 404 const Register fpscr_flags, | 405 const Register fpscr_flags, |
| 405 const Condition cond = al); | 406 const Condition cond = al); |
| 406 | 407 |
| 408 void Vmov(const DwVfpRegister dst, |
| 409 const double imm, |
| 410 const Condition cond = al); |
| 411 |
| 407 | 412 |
| 408 // --------------------------------------------------------------------------- | 413 // --------------------------------------------------------------------------- |
| 409 // Activation frames | 414 // Activation frames |
| 410 | 415 |
| 411 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } | 416 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } |
| 412 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } | 417 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } |
| 413 | 418 |
| 414 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | 419 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
| 415 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | 420 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
| 416 | 421 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 442 // Setup call kind marking in ecx. The method takes ecx as an | 447 // Setup call kind marking in ecx. The method takes ecx as an |
| 443 // explicit first parameter to make the code more readable at the | 448 // explicit first parameter to make the code more readable at the |
| 444 // call sites. | 449 // call sites. |
| 445 void SetCallKind(Register dst, CallKind kind); | 450 void SetCallKind(Register dst, CallKind kind); |
| 446 | 451 |
| 447 // Invoke the JavaScript function code by either calling or jumping. | 452 // Invoke the JavaScript function code by either calling or jumping. |
| 448 void InvokeCode(Register code, | 453 void InvokeCode(Register code, |
| 449 const ParameterCount& expected, | 454 const ParameterCount& expected, |
| 450 const ParameterCount& actual, | 455 const ParameterCount& actual, |
| 451 InvokeFlag flag, | 456 InvokeFlag flag, |
| 452 const CallWrapper& call_wrapper = NullCallWrapper(), | 457 const CallWrapper& call_wrapper, |
| 453 CallKind call_kind = CALL_AS_METHOD); | 458 CallKind call_kind); |
| 454 | 459 |
| 455 void InvokeCode(Handle<Code> code, | 460 void InvokeCode(Handle<Code> code, |
| 456 const ParameterCount& expected, | 461 const ParameterCount& expected, |
| 457 const ParameterCount& actual, | 462 const ParameterCount& actual, |
| 458 RelocInfo::Mode rmode, | 463 RelocInfo::Mode rmode, |
| 459 InvokeFlag flag, | 464 InvokeFlag flag, |
| 460 CallKind call_kind = CALL_AS_METHOD); | 465 CallKind call_kind); |
| 461 | 466 |
| 462 // Invoke the JavaScript function in the given register. Changes the | 467 // Invoke the JavaScript function in the given register. Changes the |
| 463 // current context to the context in the function before invoking. | 468 // current context to the context in the function before invoking. |
| 464 void InvokeFunction(Register function, | 469 void InvokeFunction(Register function, |
| 465 const ParameterCount& actual, | 470 const ParameterCount& actual, |
| 466 InvokeFlag flag, | 471 InvokeFlag flag, |
| 467 const CallWrapper& call_wrapper = NullCallWrapper(), | 472 const CallWrapper& call_wrapper, |
| 468 CallKind call_kind = CALL_AS_METHOD); | 473 CallKind call_kind); |
| 469 | 474 |
| 470 void InvokeFunction(JSFunction* function, | 475 void InvokeFunction(JSFunction* function, |
| 471 const ParameterCount& actual, | 476 const ParameterCount& actual, |
| 472 InvokeFlag flag); | 477 InvokeFlag flag, |
| 478 CallKind call_kind); |
| 473 | 479 |
| 474 void IsObjectJSObjectType(Register heap_object, | 480 void IsObjectJSObjectType(Register heap_object, |
| 475 Register map, | 481 Register map, |
| 476 Register scratch, | 482 Register scratch, |
| 477 Label* fail); | 483 Label* fail); |
| 478 | 484 |
| 479 void IsInstanceJSObjectType(Register map, | 485 void IsInstanceJSObjectType(Register map, |
| 480 Register scratch, | 486 Register scratch, |
| 481 Label* fail); | 487 Label* fail); |
| 482 | 488 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 513 // --------------------------------------------------------------------------- | 519 // --------------------------------------------------------------------------- |
| 514 // Inline caching support | 520 // Inline caching support |
| 515 | 521 |
| 516 // Generate code for checking access rights - used for security checks | 522 // Generate code for checking access rights - used for security checks |
| 517 // on access to global objects across environments. The holder register | 523 // on access to global objects across environments. The holder register |
| 518 // is left untouched, whereas both scratch registers are clobbered. | 524 // is left untouched, whereas both scratch registers are clobbered. |
| 519 void CheckAccessGlobalProxy(Register holder_reg, | 525 void CheckAccessGlobalProxy(Register holder_reg, |
| 520 Register scratch, | 526 Register scratch, |
| 521 Label* miss); | 527 Label* miss); |
| 522 | 528 |
| 529 |
| 530 void LoadFromNumberDictionary(Label* miss, |
| 531 Register elements, |
| 532 Register key, |
| 533 Register result, |
| 534 Register t0, |
| 535 Register t1, |
| 536 Register t2); |
| 537 |
| 538 |
| 523 inline void MarkCode(NopMarkerTypes type) { | 539 inline void MarkCode(NopMarkerTypes type) { |
| 524 nop(type); | 540 nop(type); |
| 525 } | 541 } |
| 526 | 542 |
| 527 // Check if the given instruction is a 'type' marker. | 543 // Check if the given instruction is a 'type' marker. |
| 528 // ie. check if is is a mov r<type>, r<type> (referenced as nop(type)) | 544 // ie. check if is is a mov r<type>, r<type> (referenced as nop(type)) |
| 529 // These instructions are generated to mark special location in the code, | 545 // These instructions are generated to mark special location in the code, |
| 530 // like some special IC code. | 546 // like some special IC code. |
| 531 static inline bool IsMarkedCode(Instr instr, int type) { | 547 static inline bool IsMarkedCode(Instr instr, int type) { |
| 532 ASSERT((FIRST_IC_MARKER <= type) && (type < LAST_CODE_MARKER)); | 548 ASSERT((FIRST_IC_MARKER <= type) && (type < LAST_CODE_MARKER)); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 // Compare instance type in a map. map contains a valid map object whose | 678 // Compare instance type in a map. map contains a valid map object whose |
| 663 // object type should be compared with the given type. This both | 679 // object type should be compared with the given type. This both |
| 664 // sets the flags and leaves the object type in the type_reg register. It | 680 // sets the flags and leaves the object type in the type_reg register. It |
| 665 // leaves the heap object in the heap_object register unless the heap_object | 681 // leaves the heap object in the heap_object register unless the heap_object |
| 666 // register is the same register as type_reg. | 682 // register is the same register as type_reg. |
| 667 void CompareInstanceType(Register map, | 683 void CompareInstanceType(Register map, |
| 668 Register type_reg, | 684 Register type_reg, |
| 669 InstanceType type); | 685 InstanceType type); |
| 670 | 686 |
| 671 | 687 |
| 688 // Check if a map for a JSObject indicates that the object has fast elements. |
| 689 // Jump to the specified label if it does not. |
| 690 void CheckFastElements(Register map, |
| 691 Register scratch, |
| 692 Label* fail); |
| 693 |
| 672 // Check if the map of an object is equal to a specified map (either | 694 // Check if the map of an object is equal to a specified map (either |
| 673 // given directly or as an index into the root list) and branch to | 695 // given directly or as an index into the root list) and branch to |
| 674 // label if not. Skip the smi check if not required (object is known | 696 // label if not. Skip the smi check if not required (object is known |
| 675 // to be a heap object) | 697 // to be a heap object) |
| 676 void CheckMap(Register obj, | 698 void CheckMap(Register obj, |
| 677 Register scratch, | 699 Register scratch, |
| 678 Handle<Map> map, | 700 Handle<Map> map, |
| 679 Label* fail, | 701 Label* fail, |
| 680 SmiCheckType smi_check_type); | 702 SmiCheckType smi_check_type); |
| 681 | 703 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 void LoadInstanceDescriptors(Register map, Register descriptors); | 1132 void LoadInstanceDescriptors(Register map, Register descriptors); |
| 1111 | 1133 |
| 1112 private: | 1134 private: |
| 1113 void CallCFunctionHelper(Register function, | 1135 void CallCFunctionHelper(Register function, |
| 1114 ExternalReference function_reference, | 1136 ExternalReference function_reference, |
| 1115 Register scratch, | 1137 Register scratch, |
| 1116 int num_reg_arguments, | 1138 int num_reg_arguments, |
| 1117 int num_double_arguments); | 1139 int num_double_arguments); |
| 1118 | 1140 |
| 1119 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 1141 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
| 1120 int CallSize(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | |
| 1121 void Call(intptr_t target, | |
| 1122 RelocInfo::Mode rmode, | |
| 1123 Condition cond = al); | |
| 1124 | 1142 |
| 1125 // Helper functions for generating invokes. | 1143 // Helper functions for generating invokes. |
| 1126 void InvokePrologue(const ParameterCount& expected, | 1144 void InvokePrologue(const ParameterCount& expected, |
| 1127 const ParameterCount& actual, | 1145 const ParameterCount& actual, |
| 1128 Handle<Code> code_constant, | 1146 Handle<Code> code_constant, |
| 1129 Register code_reg, | 1147 Register code_reg, |
| 1130 Label* done, | 1148 Label* done, |
| 1131 InvokeFlag flag, | 1149 InvokeFlag flag, |
| 1132 const CallWrapper& call_wrapper = NullCallWrapper(), | 1150 const CallWrapper& call_wrapper, |
| 1133 CallKind call_kind = CALL_AS_METHOD); | 1151 CallKind call_kind); |
| 1134 | 1152 |
| 1135 // Activation support. | 1153 // Activation support. |
| 1136 void EnterFrame(StackFrame::Type type); | 1154 void EnterFrame(StackFrame::Type type); |
| 1137 void LeaveFrame(StackFrame::Type type); | 1155 void LeaveFrame(StackFrame::Type type); |
| 1138 | 1156 |
| 1139 void InitializeNewString(Register string, | 1157 void InitializeNewString(Register string, |
| 1140 Register length, | 1158 Register length, |
| 1141 Heap::RootListIndex map_index, | 1159 Heap::RootListIndex map_index, |
| 1142 Register scratch1, | 1160 Register scratch1, |
| 1143 Register scratch2); | 1161 Register scratch2); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1241 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1224 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1242 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1225 #else | 1243 #else |
| 1226 #define ACCESS_MASM(masm) masm-> | 1244 #define ACCESS_MASM(masm) masm-> |
| 1227 #endif | 1245 #endif |
| 1228 | 1246 |
| 1229 | 1247 |
| 1230 } } // namespace v8::internal | 1248 } } // namespace v8::internal |
| 1231 | 1249 |
| 1232 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1250 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |