OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); | 2258 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); |
2259 // Not reached: the runtime call returns elsewhere. | 2259 // Not reached: the runtime call returns elsewhere. |
2260 __ stop("not-reached"); | 2260 __ stop("not-reached"); |
2261 | 2261 |
2262 __ bind(&done); | 2262 __ bind(&done); |
2263 context()->Plug(result_register()); | 2263 context()->Plug(result_register()); |
2264 } | 2264 } |
2265 | 2265 |
2266 | 2266 |
2267 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { | 2267 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
2268 Label gc_required; | 2268 Label allocate, done_allocate; |
2269 Label allocated; | |
2270 | 2269 |
2271 const int instance_size = 5 * kPointerSize; | 2270 __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate, TAG_OBJECT); |
2272 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), | 2271 __ b(&done_allocate); |
2273 instance_size); | |
2274 | 2272 |
2275 __ Allocate(instance_size, r3, r5, r6, &gc_required, TAG_OBJECT); | 2273 __ bind(&allocate); |
2276 __ b(&allocated); | 2274 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2275 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
2277 | 2276 |
2278 __ bind(&gc_required); | 2277 __ bind(&done_allocate); |
2279 __ Push(Smi::FromInt(instance_size)); | |
2280 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | |
2281 __ LoadP(context_register(), | |
2282 MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
2283 | |
2284 __ bind(&allocated); | |
2285 __ LoadP(r4, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 2278 __ LoadP(r4, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
2286 __ LoadP(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2279 __ LoadP(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
2287 __ LoadP(r4, ContextOperand(r4, Context::ITERATOR_RESULT_MAP_INDEX)); | 2280 __ LoadP(r4, ContextOperand(r4, Context::ITERATOR_RESULT_MAP_INDEX)); |
2288 __ pop(r5); | 2281 __ pop(r5); |
2289 __ mov(r6, Operand(isolate()->factory()->ToBoolean(done))); | 2282 __ LoadRoot(r6, |
2290 __ mov(r7, Operand(isolate()->factory()->empty_fixed_array())); | 2283 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
| 2284 __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex); |
2291 __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0); | 2285 __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0); |
2292 __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); | 2286 __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); |
2293 __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0); | 2287 __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0); |
2294 __ StoreP(r5, | 2288 __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0); |
2295 FieldMemOperand(r3, JSGeneratorObject::kResultValuePropertyOffset), | 2289 __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0); |
2296 r0); | |
2297 __ StoreP(r6, | |
2298 FieldMemOperand(r3, JSGeneratorObject::kResultDonePropertyOffset), | |
2299 r0); | |
2300 | |
2301 // Only the value field needs a write barrier, as the other values are in the | |
2302 // root set. | |
2303 __ RecordWriteField(r3, JSGeneratorObject::kResultValuePropertyOffset, r5, r6, | |
2304 kLRHasBeenSaved, kDontSaveFPRegs); | |
2305 } | 2290 } |
2306 | 2291 |
2307 | 2292 |
2308 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2293 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2309 SetExpressionPosition(prop); | 2294 SetExpressionPosition(prop); |
2310 Literal* key = prop->key()->AsLiteral(); | 2295 Literal* key = prop->key()->AsLiteral(); |
2311 DCHECK(!prop->IsSuperAccess()); | 2296 DCHECK(!prop->IsSuperAccess()); |
2312 | 2297 |
2313 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2298 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2314 __ mov(LoadDescriptor::SlotRegister(), | 2299 __ mov(LoadDescriptor::SlotRegister(), |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4509 DCHECK(expr->arguments()->length() == 0); | 4494 DCHECK(expr->arguments()->length() == 0); |
4510 ExternalReference debug_is_active = | 4495 ExternalReference debug_is_active = |
4511 ExternalReference::debug_is_active_address(isolate()); | 4496 ExternalReference::debug_is_active_address(isolate()); |
4512 __ mov(ip, Operand(debug_is_active)); | 4497 __ mov(ip, Operand(debug_is_active)); |
4513 __ lbz(r3, MemOperand(ip)); | 4498 __ lbz(r3, MemOperand(ip)); |
4514 __ SmiTag(r3); | 4499 __ SmiTag(r3); |
4515 context()->Plug(r3); | 4500 context()->Plug(r3); |
4516 } | 4501 } |
4517 | 4502 |
4518 | 4503 |
| 4504 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4505 ZoneList<Expression*>* args = expr->arguments(); |
| 4506 DCHECK_EQ(2, args->length()); |
| 4507 VisitForStackValue(args->at(0)); |
| 4508 VisitForStackValue(args->at(1)); |
| 4509 |
| 4510 Label runtime, done; |
| 4511 |
| 4512 __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &runtime, TAG_OBJECT); |
| 4513 __ LoadP(r4, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 4514 __ LoadP(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
| 4515 __ LoadP(r4, ContextOperand(r4, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4516 __ Pop(r5, r6); |
| 4517 __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex); |
| 4518 __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0); |
| 4519 __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); |
| 4520 __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0); |
| 4521 __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0); |
| 4522 __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0); |
| 4523 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4524 __ b(&done); |
| 4525 |
| 4526 __ bind(&runtime); |
| 4527 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4528 |
| 4529 __ bind(&done); |
| 4530 context()->Plug(r3); |
| 4531 } |
| 4532 |
| 4533 |
4519 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4534 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4520 // Push undefined as the receiver. | 4535 // Push undefined as the receiver. |
4521 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | 4536 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
4522 __ push(r3); | 4537 __ push(r3); |
4523 | 4538 |
4524 __ LoadP(r3, GlobalObjectOperand()); | 4539 __ LoadP(r3, GlobalObjectOperand()); |
4525 __ LoadP(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); | 4540 __ LoadP(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); |
4526 __ LoadP(r3, ContextOperand(r3, expr->context_index())); | 4541 __ LoadP(r3, ContextOperand(r3, expr->context_index())); |
4527 } | 4542 } |
4528 | 4543 |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5322 return ON_STACK_REPLACEMENT; | 5337 return ON_STACK_REPLACEMENT; |
5323 } | 5338 } |
5324 | 5339 |
5325 DCHECK(interrupt_address == | 5340 DCHECK(interrupt_address == |
5326 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5341 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5327 return OSR_AFTER_STACK_CHECK; | 5342 return OSR_AFTER_STACK_CHECK; |
5328 } | 5343 } |
5329 } // namespace internal | 5344 } // namespace internal |
5330 } // namespace v8 | 5345 } // namespace v8 |
5331 #endif // V8_TARGET_ARCH_PPC | 5346 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |