OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 // parameter count to avoid emitting code to do the check. | 799 // parameter count to avoid emitting code to do the check. |
800 ParameterCount expected(0); | 800 ParameterCount expected(0); |
801 GetBuiltinEntry(rdx, id); | 801 GetBuiltinEntry(rdx, id); |
802 InvokeCode(rdx, expected, expected, flag, call_wrapper, CALL_AS_METHOD); | 802 InvokeCode(rdx, expected, expected, flag, call_wrapper, CALL_AS_METHOD); |
803 } | 803 } |
804 | 804 |
805 | 805 |
806 void MacroAssembler::GetBuiltinFunction(Register target, | 806 void MacroAssembler::GetBuiltinFunction(Register target, |
807 Builtins::JavaScript id) { | 807 Builtins::JavaScript id) { |
808 // Load the builtins object into target register. | 808 // Load the builtins object into target register. |
809 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 809 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
810 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); | 810 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); |
811 movq(target, FieldOperand(target, | 811 movq(target, FieldOperand(target, |
812 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 812 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
813 } | 813 } |
814 | 814 |
815 | 815 |
816 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 816 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
817 ASSERT(!target.is(rdi)); | 817 ASSERT(!target.is(rdi)); |
818 // Load the JavaScript builtin function from the builtins object. | 818 // Load the JavaScript builtin function from the builtins object. |
819 GetBuiltinFunction(rdi, id); | 819 GetBuiltinFunction(rdi, id); |
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 ASSERT(!scratch.is(kScratchRegister)); | 3436 ASSERT(!scratch.is(kScratchRegister)); |
3437 // Load current lexical context from the stack frame. | 3437 // Load current lexical context from the stack frame. |
3438 movq(scratch, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3438 movq(scratch, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3439 | 3439 |
3440 // When generating debug code, make sure the lexical context is set. | 3440 // When generating debug code, make sure the lexical context is set. |
3441 if (emit_debug_code()) { | 3441 if (emit_debug_code()) { |
3442 cmpq(scratch, Immediate(0)); | 3442 cmpq(scratch, Immediate(0)); |
3443 Check(not_equal, "we should not have an empty lexical context"); | 3443 Check(not_equal, "we should not have an empty lexical context"); |
3444 } | 3444 } |
3445 // Load the native context of the current context. | 3445 // Load the native context of the current context. |
3446 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 3446 int offset = |
| 3447 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
3447 movq(scratch, FieldOperand(scratch, offset)); | 3448 movq(scratch, FieldOperand(scratch, offset)); |
3448 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 3449 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
3449 | 3450 |
3450 // Check the context is a native context. | 3451 // Check the context is a native context. |
3451 if (emit_debug_code()) { | 3452 if (emit_debug_code()) { |
3452 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), | 3453 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), |
3453 isolate()->factory()->native_context_map()); | 3454 isolate()->factory()->native_context_map()); |
3454 Check(equal, "JSGlobalObject::native_context should be a native context."); | 3455 Check(equal, "JSGlobalObject::native_context should be a native context."); |
3455 } | 3456 } |
3456 | 3457 |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4092 } | 4093 } |
4093 | 4094 |
4094 | 4095 |
4095 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4096 void MacroAssembler::LoadTransitionedArrayMapConditional( |
4096 ElementsKind expected_kind, | 4097 ElementsKind expected_kind, |
4097 ElementsKind transitioned_kind, | 4098 ElementsKind transitioned_kind, |
4098 Register map_in_out, | 4099 Register map_in_out, |
4099 Register scratch, | 4100 Register scratch, |
4100 Label* no_map_match) { | 4101 Label* no_map_match) { |
4101 // Load the global or builtins object from the current context. | 4102 // Load the global or builtins object from the current context. |
4102 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4103 movq(scratch, |
| 4104 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4103 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 4105 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
4104 | 4106 |
4105 // Check that the function's map is the same as the expected cached map. | 4107 // Check that the function's map is the same as the expected cached map. |
4106 movq(scratch, Operand(scratch, | 4108 movq(scratch, Operand(scratch, |
4107 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4109 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
4108 | 4110 |
4109 int offset = expected_kind * kPointerSize + | 4111 int offset = expected_kind * kPointerSize + |
4110 FixedArrayBase::kHeaderSize; | 4112 FixedArrayBase::kHeaderSize; |
4111 cmpq(map_in_out, FieldOperand(scratch, offset)); | 4113 cmpq(map_in_out, FieldOperand(scratch, offset)); |
4112 j(not_equal, no_map_match); | 4114 j(not_equal, no_map_match); |
(...skipping 30 matching lines...) Expand all Loading... |
4143 } | 4145 } |
4144 | 4146 |
4145 #ifdef _WIN64 | 4147 #ifdef _WIN64 |
4146 static const int kRegisterPassedArguments = 4; | 4148 static const int kRegisterPassedArguments = 4; |
4147 #else | 4149 #else |
4148 static const int kRegisterPassedArguments = 6; | 4150 static const int kRegisterPassedArguments = 6; |
4149 #endif | 4151 #endif |
4150 | 4152 |
4151 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4153 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
4152 // Load the global or builtins object from the current context. | 4154 // Load the global or builtins object from the current context. |
4153 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4155 movq(function, |
| 4156 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4154 // Load the native context from the global or builtins object. | 4157 // Load the native context from the global or builtins object. |
4155 movq(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); | 4158 movq(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); |
4156 // Load the function from the native context. | 4159 // Load the function from the native context. |
4157 movq(function, Operand(function, Context::SlotOffset(index))); | 4160 movq(function, Operand(function, Context::SlotOffset(index))); |
4158 } | 4161 } |
4159 | 4162 |
4160 | 4163 |
4161 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4164 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
4162 Register map) { | 4165 Register map) { |
4163 // Load the initial map. The global functions all have initial maps. | 4166 // Load the initial map. The global functions all have initial maps. |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4501 bind(&check_prototype); | 4504 bind(&check_prototype); |
4502 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4505 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4503 cmpq(rcx, null_value); | 4506 cmpq(rcx, null_value); |
4504 j(not_equal, &next); | 4507 j(not_equal, &next); |
4505 } | 4508 } |
4506 | 4509 |
4507 | 4510 |
4508 } } // namespace v8::internal | 4511 } } // namespace v8::internal |
4509 | 4512 |
4510 #endif // V8_TARGET_ARCH_X64 | 4513 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |