| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (info->MustReplaceUndefinedReceiverWithGlobalProxy()) { | 111 if (info->MustReplaceUndefinedReceiverWithGlobalProxy()) { |
| 112 Label ok; | 112 Label ok; |
| 113 // +1 for return address. | 113 // +1 for return address. |
| 114 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 114 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
| 115 __ mov(ecx, Operand(esp, receiver_offset)); | 115 __ mov(ecx, Operand(esp, receiver_offset)); |
| 116 | 116 |
| 117 __ cmp(ecx, isolate()->factory()->undefined_value()); | 117 __ cmp(ecx, isolate()->factory()->undefined_value()); |
| 118 __ j(not_equal, &ok, Label::kNear); | 118 __ j(not_equal, &ok, Label::kNear); |
| 119 | 119 |
| 120 __ mov(ecx, GlobalObjectOperand()); | 120 __ mov(ecx, GlobalObjectOperand()); |
| 121 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); | 121 __ mov(ecx, FieldOperand(ecx, JSGlobalObject::kGlobalProxyOffset)); |
| 122 | 122 |
| 123 __ mov(Operand(esp, receiver_offset), ecx); | 123 __ mov(Operand(esp, receiver_offset), ecx); |
| 124 | 124 |
| 125 __ bind(&ok); | 125 __ bind(&ok); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Open a frame scope to indicate that there is a frame on the stack. The | 128 // Open a frame scope to indicate that there is a frame on the stack. The |
| 129 // MANUAL indicates that the scope shouldn't actually generate code to set up | 129 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 130 // the frame (that is done below). | 130 // the frame (that is done below). |
| 131 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 131 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
| (...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 | 2171 |
| 2172 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); | 2172 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); |
| 2173 __ jmp(&done_allocate, Label::kNear); | 2173 __ jmp(&done_allocate, Label::kNear); |
| 2174 | 2174 |
| 2175 __ bind(&allocate); | 2175 __ bind(&allocate); |
| 2176 __ Push(Smi::FromInt(JSIteratorResult::kSize)); | 2176 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2177 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 2177 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 2178 | 2178 |
| 2179 __ bind(&done_allocate); | 2179 __ bind(&done_allocate); |
| 2180 __ mov(ebx, GlobalObjectOperand()); | 2180 __ mov(ebx, GlobalObjectOperand()); |
| 2181 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); | 2181 __ mov(ebx, FieldOperand(ebx, JSGlobalObject::kNativeContextOffset)); |
| 2182 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); | 2182 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 2183 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); | 2183 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
| 2184 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 2184 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
| 2185 isolate()->factory()->empty_fixed_array()); | 2185 isolate()->factory()->empty_fixed_array()); |
| 2186 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 2186 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
| 2187 isolate()->factory()->empty_fixed_array()); | 2187 isolate()->factory()->empty_fixed_array()); |
| 2188 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); | 2188 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
| 2189 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset), | 2189 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset), |
| 2190 isolate()->factory()->ToBoolean(done)); | 2190 isolate()->factory()->ToBoolean(done)); |
| 2191 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 2191 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4168 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { | 4168 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4169 ZoneList<Expression*>* args = expr->arguments(); | 4169 ZoneList<Expression*>* args = expr->arguments(); |
| 4170 DCHECK_EQ(2, args->length()); | 4170 DCHECK_EQ(2, args->length()); |
| 4171 VisitForStackValue(args->at(0)); | 4171 VisitForStackValue(args->at(0)); |
| 4172 VisitForStackValue(args->at(1)); | 4172 VisitForStackValue(args->at(1)); |
| 4173 | 4173 |
| 4174 Label runtime, done; | 4174 Label runtime, done; |
| 4175 | 4175 |
| 4176 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); | 4176 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); |
| 4177 __ mov(ebx, GlobalObjectOperand()); | 4177 __ mov(ebx, GlobalObjectOperand()); |
| 4178 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); | 4178 __ mov(ebx, FieldOperand(ebx, JSGlobalObject::kNativeContextOffset)); |
| 4179 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); | 4179 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4180 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); | 4180 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
| 4181 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 4181 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
| 4182 isolate()->factory()->empty_fixed_array()); | 4182 isolate()->factory()->empty_fixed_array()); |
| 4183 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 4183 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
| 4184 isolate()->factory()->empty_fixed_array()); | 4184 isolate()->factory()->empty_fixed_array()); |
| 4185 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset)); | 4185 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset)); |
| 4186 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); | 4186 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
| 4187 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 4187 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4188 __ jmp(&done, Label::kNear); | 4188 __ jmp(&done, Label::kNear); |
| 4189 | 4189 |
| 4190 __ bind(&runtime); | 4190 __ bind(&runtime); |
| 4191 __ CallRuntime(Runtime::kCreateIterResultObject, 2); | 4191 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4192 | 4192 |
| 4193 __ bind(&done); | 4193 __ bind(&done); |
| 4194 context()->Plug(eax); | 4194 context()->Plug(eax); |
| 4195 } | 4195 } |
| 4196 | 4196 |
| 4197 | 4197 |
| 4198 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4198 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4199 // Push undefined as receiver. | 4199 // Push undefined as receiver. |
| 4200 __ push(Immediate(isolate()->factory()->undefined_value())); | 4200 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 4201 | 4201 |
| 4202 __ mov(eax, GlobalObjectOperand()); | 4202 __ mov(eax, GlobalObjectOperand()); |
| 4203 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); | 4203 __ mov(eax, FieldOperand(eax, JSGlobalObject::kNativeContextOffset)); |
| 4204 __ mov(eax, ContextOperand(eax, expr->context_index())); | 4204 __ mov(eax, ContextOperand(eax, expr->context_index())); |
| 4205 } | 4205 } |
| 4206 | 4206 |
| 4207 | 4207 |
| 4208 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4208 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4209 ZoneList<Expression*>* args = expr->arguments(); | 4209 ZoneList<Expression*>* args = expr->arguments(); |
| 4210 int arg_count = args->length(); | 4210 int arg_count = args->length(); |
| 4211 | 4211 |
| 4212 SetCallPosition(expr, arg_count); | 4212 SetCallPosition(expr, arg_count); |
| 4213 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4213 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5014 Assembler::target_address_at(call_target_address, | 5014 Assembler::target_address_at(call_target_address, |
| 5015 unoptimized_code)); | 5015 unoptimized_code)); |
| 5016 return OSR_AFTER_STACK_CHECK; | 5016 return OSR_AFTER_STACK_CHECK; |
| 5017 } | 5017 } |
| 5018 | 5018 |
| 5019 | 5019 |
| 5020 } // namespace internal | 5020 } // namespace internal |
| 5021 } // namespace v8 | 5021 } // namespace v8 |
| 5022 | 5022 |
| 5023 #endif // V8_TARGET_ARCH_IA32 | 5023 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |