| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 | 2164 |
| 2165 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); | 2165 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); |
| 2166 __ jmp(&done_allocate, Label::kNear); | 2166 __ jmp(&done_allocate, Label::kNear); |
| 2167 | 2167 |
| 2168 __ bind(&allocate); | 2168 __ bind(&allocate); |
| 2169 __ Push(Smi::FromInt(JSIteratorResult::kSize)); | 2169 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2170 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 2170 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 2171 | 2171 |
| 2172 __ bind(&done_allocate); | 2172 __ bind(&done_allocate); |
| 2173 __ mov(ebx, GlobalObjectOperand()); | 2173 __ mov(ebx, GlobalObjectOperand()); |
| 2174 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); | 2174 __ mov(ebx, FieldOperand(ebx, JSGlobalObject::kNativeContextOffset)); |
| 2175 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); | 2175 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 2176 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); | 2176 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
| 2177 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 2177 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
| 2178 isolate()->factory()->empty_fixed_array()); | 2178 isolate()->factory()->empty_fixed_array()); |
| 2179 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 2179 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
| 2180 isolate()->factory()->empty_fixed_array()); | 2180 isolate()->factory()->empty_fixed_array()); |
| 2181 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); | 2181 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
| 2182 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset), | 2182 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset), |
| 2183 isolate()->factory()->ToBoolean(done)); | 2183 isolate()->factory()->ToBoolean(done)); |
| 2184 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 2184 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4161 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { | 4161 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4162 ZoneList<Expression*>* args = expr->arguments(); | 4162 ZoneList<Expression*>* args = expr->arguments(); |
| 4163 DCHECK_EQ(2, args->length()); | 4163 DCHECK_EQ(2, args->length()); |
| 4164 VisitForStackValue(args->at(0)); | 4164 VisitForStackValue(args->at(0)); |
| 4165 VisitForStackValue(args->at(1)); | 4165 VisitForStackValue(args->at(1)); |
| 4166 | 4166 |
| 4167 Label runtime, done; | 4167 Label runtime, done; |
| 4168 | 4168 |
| 4169 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); | 4169 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); |
| 4170 __ mov(ebx, GlobalObjectOperand()); | 4170 __ mov(ebx, GlobalObjectOperand()); |
| 4171 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); | 4171 __ mov(ebx, FieldOperand(ebx, JSGlobalObject::kNativeContextOffset)); |
| 4172 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); | 4172 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4173 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); | 4173 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
| 4174 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 4174 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
| 4175 isolate()->factory()->empty_fixed_array()); | 4175 isolate()->factory()->empty_fixed_array()); |
| 4176 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 4176 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
| 4177 isolate()->factory()->empty_fixed_array()); | 4177 isolate()->factory()->empty_fixed_array()); |
| 4178 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset)); | 4178 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset)); |
| 4179 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); | 4179 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
| 4180 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 4180 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4181 __ jmp(&done, Label::kNear); | 4181 __ jmp(&done, Label::kNear); |
| 4182 | 4182 |
| 4183 __ bind(&runtime); | 4183 __ bind(&runtime); |
| 4184 __ CallRuntime(Runtime::kCreateIterResultObject, 2); | 4184 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4185 | 4185 |
| 4186 __ bind(&done); | 4186 __ bind(&done); |
| 4187 context()->Plug(eax); | 4187 context()->Plug(eax); |
| 4188 } | 4188 } |
| 4189 | 4189 |
| 4190 | 4190 |
| 4191 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4191 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4192 // Push undefined as receiver. | 4192 // Push undefined as receiver. |
| 4193 __ push(Immediate(isolate()->factory()->undefined_value())); | 4193 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 4194 | 4194 |
| 4195 __ mov(eax, GlobalObjectOperand()); | 4195 __ mov(eax, GlobalObjectOperand()); |
| 4196 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); | 4196 __ mov(eax, FieldOperand(eax, JSGlobalObject::kNativeContextOffset)); |
| 4197 __ mov(eax, ContextOperand(eax, expr->context_index())); | 4197 __ mov(eax, ContextOperand(eax, expr->context_index())); |
| 4198 } | 4198 } |
| 4199 | 4199 |
| 4200 | 4200 |
| 4201 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4201 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4202 ZoneList<Expression*>* args = expr->arguments(); | 4202 ZoneList<Expression*>* args = expr->arguments(); |
| 4203 int arg_count = args->length(); | 4203 int arg_count = args->length(); |
| 4204 | 4204 |
| 4205 SetCallPosition(expr, arg_count); | 4205 SetCallPosition(expr, arg_count); |
| 4206 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4206 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5007 Assembler::target_address_at(call_target_address, | 5007 Assembler::target_address_at(call_target_address, |
| 5008 unoptimized_code)); | 5008 unoptimized_code)); |
| 5009 return OSR_AFTER_STACK_CHECK; | 5009 return OSR_AFTER_STACK_CHECK; |
| 5010 } | 5010 } |
| 5011 | 5011 |
| 5012 | 5012 |
| 5013 } // namespace internal | 5013 } // namespace internal |
| 5014 } // namespace v8 | 5014 } // namespace v8 |
| 5015 | 5015 |
| 5016 #endif // V8_TARGET_ARCH_X87 | 5016 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |