| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (info->MustReplaceUndefinedReceiverWithGlobalProxy()) { | 110 if (info->MustReplaceUndefinedReceiverWithGlobalProxy()) { |
| 111 Label ok; | 111 Label ok; |
| 112 // +1 for return address. | 112 // +1 for return address. |
| 113 StackArgumentsAccessor args(rsp, info->scope()->num_parameters()); | 113 StackArgumentsAccessor args(rsp, info->scope()->num_parameters()); |
| 114 __ movp(rcx, args.GetReceiverOperand()); | 114 __ movp(rcx, args.GetReceiverOperand()); |
| 115 | 115 |
| 116 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); | 116 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); |
| 117 __ j(not_equal, &ok, Label::kNear); | 117 __ j(not_equal, &ok, Label::kNear); |
| 118 | 118 |
| 119 __ movp(rcx, GlobalObjectOperand()); | 119 __ movp(rcx, GlobalObjectOperand()); |
| 120 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalProxyOffset)); | 120 __ movp(rcx, FieldOperand(rcx, JSGlobalObject::kGlobalProxyOffset)); |
| 121 | 121 |
| 122 __ movp(args.GetReceiverOperand(), rcx); | 122 __ movp(args.GetReceiverOperand(), rcx); |
| 123 | 123 |
| 124 __ bind(&ok); | 124 __ bind(&ok); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Open a frame scope to indicate that there is a frame on the stack. The | 127 // Open a frame scope to indicate that there is a frame on the stack. The |
| 128 // MANUAL indicates that the scope shouldn't actually generate code to set up | 128 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 129 // the frame (that is done below). | 129 // the frame (that is done below). |
| 130 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 130 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 | 2197 |
| 2198 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &allocate, TAG_OBJECT); | 2198 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &allocate, TAG_OBJECT); |
| 2199 __ jmp(&done_allocate, Label::kNear); | 2199 __ jmp(&done_allocate, Label::kNear); |
| 2200 | 2200 |
| 2201 __ bind(&allocate); | 2201 __ bind(&allocate); |
| 2202 __ Push(Smi::FromInt(JSIteratorResult::kSize)); | 2202 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2203 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 2203 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 2204 | 2204 |
| 2205 __ bind(&done_allocate); | 2205 __ bind(&done_allocate); |
| 2206 __ movp(rbx, GlobalObjectOperand()); | 2206 __ movp(rbx, GlobalObjectOperand()); |
| 2207 __ movp(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); | 2207 __ movp(rbx, FieldOperand(rbx, JSGlobalObject::kNativeContextOffset)); |
| 2208 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX)); | 2208 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 2209 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); | 2209 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); |
| 2210 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 2210 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
| 2211 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 2211 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
| 2212 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 2212 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
| 2213 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset)); | 2213 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset)); |
| 2214 __ LoadRoot(FieldOperand(rax, JSIteratorResult::kDoneOffset), | 2214 __ LoadRoot(FieldOperand(rax, JSIteratorResult::kDoneOffset), |
| 2215 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); | 2215 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
| 2216 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 2216 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 2217 } | 2217 } |
| (...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4185 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { | 4185 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4186 ZoneList<Expression*>* args = expr->arguments(); | 4186 ZoneList<Expression*>* args = expr->arguments(); |
| 4187 DCHECK_EQ(2, args->length()); | 4187 DCHECK_EQ(2, args->length()); |
| 4188 VisitForStackValue(args->at(0)); | 4188 VisitForStackValue(args->at(0)); |
| 4189 VisitForStackValue(args->at(1)); | 4189 VisitForStackValue(args->at(1)); |
| 4190 | 4190 |
| 4191 Label runtime, done; | 4191 Label runtime, done; |
| 4192 | 4192 |
| 4193 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &runtime, TAG_OBJECT); | 4193 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &runtime, TAG_OBJECT); |
| 4194 __ movp(rbx, GlobalObjectOperand()); | 4194 __ movp(rbx, GlobalObjectOperand()); |
| 4195 __ movp(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); | 4195 __ movp(rbx, FieldOperand(rbx, JSGlobalObject::kNativeContextOffset)); |
| 4196 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX)); | 4196 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4197 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); | 4197 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); |
| 4198 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 4198 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
| 4199 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 4199 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
| 4200 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 4200 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
| 4201 __ Pop(FieldOperand(rax, JSIteratorResult::kDoneOffset)); | 4201 __ Pop(FieldOperand(rax, JSIteratorResult::kDoneOffset)); |
| 4202 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset)); | 4202 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset)); |
| 4203 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 4203 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4204 __ jmp(&done, Label::kNear); | 4204 __ jmp(&done, Label::kNear); |
| 4205 | 4205 |
| 4206 __ bind(&runtime); | 4206 __ bind(&runtime); |
| 4207 __ CallRuntime(Runtime::kCreateIterResultObject, 2); | 4207 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4208 | 4208 |
| 4209 __ bind(&done); | 4209 __ bind(&done); |
| 4210 context()->Plug(rax); | 4210 context()->Plug(rax); |
| 4211 } | 4211 } |
| 4212 | 4212 |
| 4213 | 4213 |
| 4214 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4214 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4215 // Push the builtins object as receiver. | 4215 // Push the builtins object as receiver. |
| 4216 __ PushRoot(Heap::kUndefinedValueRootIndex); | 4216 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 4217 | 4217 |
| 4218 __ movp(rax, GlobalObjectOperand()); | 4218 __ movp(rax, GlobalObjectOperand()); |
| 4219 __ movp(rax, FieldOperand(rax, GlobalObject::kNativeContextOffset)); | 4219 __ movp(rax, FieldOperand(rax, JSGlobalObject::kNativeContextOffset)); |
| 4220 __ movp(rax, ContextOperand(rax, expr->context_index())); | 4220 __ movp(rax, ContextOperand(rax, expr->context_index())); |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 | 4223 |
| 4224 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4224 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4225 ZoneList<Expression*>* args = expr->arguments(); | 4225 ZoneList<Expression*>* args = expr->arguments(); |
| 4226 int arg_count = args->length(); | 4226 int arg_count = args->length(); |
| 4227 | 4227 |
| 4228 SetCallPosition(expr, arg_count); | 4228 SetCallPosition(expr, arg_count); |
| 4229 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4229 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 Assembler::target_address_at(call_target_address, | 5030 Assembler::target_address_at(call_target_address, |
| 5031 unoptimized_code)); | 5031 unoptimized_code)); |
| 5032 return OSR_AFTER_STACK_CHECK; | 5032 return OSR_AFTER_STACK_CHECK; |
| 5033 } | 5033 } |
| 5034 | 5034 |
| 5035 | 5035 |
| 5036 } // namespace internal | 5036 } // namespace internal |
| 5037 } // namespace v8 | 5037 } // namespace v8 |
| 5038 | 5038 |
| 5039 #endif // V8_TARGET_ARCH_X64 | 5039 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |