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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); | 2268 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); |
2269 // Not reached: the runtime call returns elsewhere. | 2269 // Not reached: the runtime call returns elsewhere. |
2270 __ stop("not-reached"); | 2270 __ stop("not-reached"); |
2271 | 2271 |
2272 __ bind(&done); | 2272 __ bind(&done); |
2273 context()->Plug(result_register()); | 2273 context()->Plug(result_register()); |
2274 } | 2274 } |
2275 | 2275 |
2276 | 2276 |
2277 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { | 2277 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
2278 Label gc_required; | 2278 Label allocate, done_allocate; |
2279 Label allocated; | |
2280 | 2279 |
2281 const int instance_size = 5 * kPointerSize; | 2280 __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &allocate, TAG_OBJECT); |
2282 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), | 2281 __ b(&done_allocate); |
2283 instance_size); | |
2284 | 2282 |
2285 __ Allocate(instance_size, r0, r2, r3, &gc_required, TAG_OBJECT); | 2283 __ bind(&allocate); |
2286 __ jmp(&allocated); | 2284 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2285 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
2287 | 2286 |
2288 __ bind(&gc_required); | 2287 __ bind(&done_allocate); |
2289 __ Push(Smi::FromInt(instance_size)); | |
2290 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | |
2291 __ ldr(context_register(), | |
2292 MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
2293 | |
2294 __ bind(&allocated); | |
2295 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 2288 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
2296 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kNativeContextOffset)); | 2289 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kNativeContextOffset)); |
2297 __ ldr(r1, ContextOperand(r1, Context::ITERATOR_RESULT_MAP_INDEX)); | 2290 __ ldr(r1, ContextOperand(r1, Context::ITERATOR_RESULT_MAP_INDEX)); |
2298 __ pop(r2); | 2291 __ pop(r2); |
2299 __ mov(r3, Operand(isolate()->factory()->ToBoolean(done))); | 2292 __ LoadRoot(r3, |
2300 __ mov(r4, Operand(isolate()->factory()->empty_fixed_array())); | 2293 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
| 2294 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
2301 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 2295 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
2302 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 2296 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
2303 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2297 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
2304 __ str(r2, | 2298 __ str(r2, FieldMemOperand(r0, JSIteratorResult::kValueOffset)); |
2305 FieldMemOperand(r0, JSGeneratorObject::kResultValuePropertyOffset)); | 2299 __ str(r3, FieldMemOperand(r0, JSIteratorResult::kDoneOffset)); |
2306 __ str(r3, | |
2307 FieldMemOperand(r0, JSGeneratorObject::kResultDonePropertyOffset)); | |
2308 | |
2309 // Only the value field needs a write barrier, as the other values are in the | |
2310 // root set. | |
2311 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, | |
2312 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | |
2313 } | 2300 } |
2314 | 2301 |
2315 | 2302 |
2316 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2303 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2317 SetExpressionPosition(prop); | 2304 SetExpressionPosition(prop); |
2318 Literal* key = prop->key()->AsLiteral(); | 2305 Literal* key = prop->key()->AsLiteral(); |
2319 DCHECK(!prop->IsSuperAccess()); | 2306 DCHECK(!prop->IsSuperAccess()); |
2320 | 2307 |
2321 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2308 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2322 __ mov(LoadDescriptor::SlotRegister(), | 2309 __ mov(LoadDescriptor::SlotRegister(), |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 DCHECK(expr->arguments()->length() == 0); | 4453 DCHECK(expr->arguments()->length() == 0); |
4467 ExternalReference debug_is_active = | 4454 ExternalReference debug_is_active = |
4468 ExternalReference::debug_is_active_address(isolate()); | 4455 ExternalReference::debug_is_active_address(isolate()); |
4469 __ mov(ip, Operand(debug_is_active)); | 4456 __ mov(ip, Operand(debug_is_active)); |
4470 __ ldrb(r0, MemOperand(ip)); | 4457 __ ldrb(r0, MemOperand(ip)); |
4471 __ SmiTag(r0); | 4458 __ SmiTag(r0); |
4472 context()->Plug(r0); | 4459 context()->Plug(r0); |
4473 } | 4460 } |
4474 | 4461 |
4475 | 4462 |
| 4463 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4464 ZoneList<Expression*>* args = expr->arguments(); |
| 4465 DCHECK_EQ(2, args->length()); |
| 4466 VisitForStackValue(args->at(0)); |
| 4467 VisitForStackValue(args->at(1)); |
| 4468 |
| 4469 Label runtime, done; |
| 4470 |
| 4471 __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &runtime, TAG_OBJECT); |
| 4472 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 4473 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kNativeContextOffset)); |
| 4474 __ ldr(r1, ContextOperand(r1, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4475 __ pop(r3); |
| 4476 __ pop(r2); |
| 4477 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
| 4478 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 4479 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 4480 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 4481 __ str(r2, FieldMemOperand(r0, JSIteratorResult::kValueOffset)); |
| 4482 __ str(r3, FieldMemOperand(r0, JSIteratorResult::kDoneOffset)); |
| 4483 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4484 __ b(&done); |
| 4485 |
| 4486 __ bind(&runtime); |
| 4487 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4488 |
| 4489 __ bind(&done); |
| 4490 context()->Plug(r0); |
| 4491 } |
| 4492 |
| 4493 |
4476 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4494 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4477 // Push undefined as the receiver. | 4495 // Push undefined as the receiver. |
4478 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 4496 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
4479 __ push(r0); | 4497 __ push(r0); |
4480 | 4498 |
4481 __ ldr(r0, GlobalObjectOperand()); | 4499 __ ldr(r0, GlobalObjectOperand()); |
4482 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); | 4500 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); |
4483 __ ldr(r0, ContextOperand(r0, expr->context_index())); | 4501 __ ldr(r0, ContextOperand(r0, expr->context_index())); |
4484 } | 4502 } |
4485 | 4503 |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5352 DCHECK(interrupt_address == | 5370 DCHECK(interrupt_address == |
5353 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5371 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5354 return OSR_AFTER_STACK_CHECK; | 5372 return OSR_AFTER_STACK_CHECK; |
5355 } | 5373 } |
5356 | 5374 |
5357 | 5375 |
5358 } // namespace internal | 5376 } // namespace internal |
5359 } // namespace v8 | 5377 } // namespace v8 |
5360 | 5378 |
5361 #endif // V8_TARGET_ARCH_ARM | 5379 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |