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/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); | 2194 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); |
2195 // Not reached: the runtime call returns elsewhere. | 2195 // Not reached: the runtime call returns elsewhere. |
2196 __ Abort(kGeneratorFailedToResume); | 2196 __ Abort(kGeneratorFailedToResume); |
2197 | 2197 |
2198 __ bind(&done); | 2198 __ bind(&done); |
2199 context()->Plug(result_register()); | 2199 context()->Plug(result_register()); |
2200 } | 2200 } |
2201 | 2201 |
2202 | 2202 |
2203 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { | 2203 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
2204 Label gc_required; | 2204 Label allocate, done_allocate; |
2205 Label allocated; | |
2206 | 2205 |
2207 const int instance_size = 5 * kPointerSize; | 2206 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); |
2208 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), | 2207 __ jmp(&done_allocate, Label::kNear); |
2209 instance_size); | |
2210 | 2208 |
2211 __ Allocate(instance_size, eax, ecx, edx, &gc_required, TAG_OBJECT); | 2209 __ bind(&allocate); |
2212 __ jmp(&allocated); | 2210 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2211 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
2213 | 2212 |
2214 __ bind(&gc_required); | 2213 __ bind(&done_allocate); |
2215 __ Push(Smi::FromInt(instance_size)); | 2214 __ mov(ebx, GlobalObjectOperand()); |
2216 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | |
2217 __ mov(context_register(), | |
2218 Operand(ebp, StandardFrameConstants::kContextOffset)); | |
2219 | |
2220 __ bind(&allocated); | |
2221 __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
2222 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); | 2215 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); |
2223 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); | 2216 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
2224 __ pop(ecx); | |
2225 __ mov(edx, isolate()->factory()->ToBoolean(done)); | |
2226 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); | 2217 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
2227 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 2218 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
2228 isolate()->factory()->empty_fixed_array()); | 2219 isolate()->factory()->empty_fixed_array()); |
2229 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 2220 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
2230 isolate()->factory()->empty_fixed_array()); | 2221 isolate()->factory()->empty_fixed_array()); |
2231 __ mov(FieldOperand(eax, JSGeneratorObject::kResultValuePropertyOffset), ecx); | 2222 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
2232 __ mov(FieldOperand(eax, JSGeneratorObject::kResultDonePropertyOffset), edx); | 2223 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset), |
2233 | 2224 isolate()->factory()->ToBoolean(done)); |
2234 // Only the value field needs a write barrier, as the other values are in the | 2225 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
2235 // root set. | |
2236 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, ecx, | |
2237 edx, kDontSaveFPRegs); | |
2238 } | 2226 } |
2239 | 2227 |
2240 | 2228 |
2241 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2229 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2242 SetExpressionPosition(prop); | 2230 SetExpressionPosition(prop); |
2243 Literal* key = prop->key()->AsLiteral(); | 2231 Literal* key = prop->key()->AsLiteral(); |
2244 DCHECK(!key->value()->IsSmi()); | 2232 DCHECK(!key->value()->IsSmi()); |
2245 DCHECK(!prop->IsSuperAccess()); | 2233 DCHECK(!prop->IsSuperAccess()); |
2246 | 2234 |
2247 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); | 2235 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4392 void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) { | 4380 void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) { |
4393 DCHECK(expr->arguments()->length() == 0); | 4381 DCHECK(expr->arguments()->length() == 0); |
4394 ExternalReference debug_is_active = | 4382 ExternalReference debug_is_active = |
4395 ExternalReference::debug_is_active_address(isolate()); | 4383 ExternalReference::debug_is_active_address(isolate()); |
4396 __ movzx_b(eax, Operand::StaticVariable(debug_is_active)); | 4384 __ movzx_b(eax, Operand::StaticVariable(debug_is_active)); |
4397 __ SmiTag(eax); | 4385 __ SmiTag(eax); |
4398 context()->Plug(eax); | 4386 context()->Plug(eax); |
4399 } | 4387 } |
4400 | 4388 |
4401 | 4389 |
| 4390 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4391 ZoneList<Expression*>* args = expr->arguments(); |
| 4392 DCHECK_EQ(2, args->length()); |
| 4393 VisitForStackValue(args->at(0)); |
| 4394 VisitForStackValue(args->at(1)); |
| 4395 |
| 4396 Label runtime, done; |
| 4397 |
| 4398 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); |
| 4399 __ mov(ebx, GlobalObjectOperand()); |
| 4400 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); |
| 4401 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4402 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); |
| 4403 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
| 4404 isolate()->factory()->empty_fixed_array()); |
| 4405 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
| 4406 isolate()->factory()->empty_fixed_array()); |
| 4407 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset)); |
| 4408 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset)); |
| 4409 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4410 __ jmp(&done, Label::kNear); |
| 4411 |
| 4412 __ bind(&runtime); |
| 4413 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4414 |
| 4415 __ bind(&done); |
| 4416 context()->Plug(eax); |
| 4417 } |
| 4418 |
| 4419 |
4402 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4420 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4403 // Push undefined as receiver. | 4421 // Push undefined as receiver. |
4404 __ push(Immediate(isolate()->factory()->undefined_value())); | 4422 __ push(Immediate(isolate()->factory()->undefined_value())); |
4405 | 4423 |
4406 __ mov(eax, GlobalObjectOperand()); | 4424 __ mov(eax, GlobalObjectOperand()); |
4407 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); | 4425 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); |
4408 __ mov(eax, ContextOperand(eax, expr->context_index())); | 4426 __ mov(eax, ContextOperand(eax, expr->context_index())); |
4409 } | 4427 } |
4410 | 4428 |
4411 | 4429 |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5218 Assembler::target_address_at(call_target_address, | 5236 Assembler::target_address_at(call_target_address, |
5219 unoptimized_code)); | 5237 unoptimized_code)); |
5220 return OSR_AFTER_STACK_CHECK; | 5238 return OSR_AFTER_STACK_CHECK; |
5221 } | 5239 } |
5222 | 5240 |
5223 | 5241 |
5224 } // namespace internal | 5242 } // namespace internal |
5225 } // namespace v8 | 5243 } // namespace v8 |
5226 | 5244 |
5227 #endif // V8_TARGET_ARCH_X87 | 5245 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |