| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 4268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4279 DCHECK(args->length() == 3); | 4279 DCHECK(args->length() == 3); |
| 4280 VisitForStackValue(args->at(0)); | 4280 VisitForStackValue(args->at(0)); |
| 4281 VisitForStackValue(args->at(1)); | 4281 VisitForStackValue(args->at(1)); |
| 4282 VisitForAccumulatorValue(args->at(2)); | 4282 VisitForAccumulatorValue(args->at(2)); |
| 4283 __ Pop(r5, r4); | 4283 __ Pop(r5, r4); |
| 4284 __ CallStub(&stub); | 4284 __ CallStub(&stub); |
| 4285 context()->Plug(r3); | 4285 context()->Plug(r3); |
| 4286 } | 4286 } |
| 4287 | 4287 |
| 4288 | 4288 |
| 4289 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | |
| 4290 ZoneList<Expression*>* args = expr->arguments(); | |
| 4291 DCHECK_EQ(2, args->length()); | |
| 4292 DCHECK_NOT_NULL(args->at(0)->AsLiteral()); | |
| 4293 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | |
| 4294 | |
| 4295 Handle<FixedArray> jsfunction_result_caches( | |
| 4296 isolate()->native_context()->jsfunction_result_caches()); | |
| 4297 if (jsfunction_result_caches->length() <= cache_id) { | |
| 4298 __ Abort(kAttemptToUseUndefinedCache); | |
| 4299 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | |
| 4300 context()->Plug(r3); | |
| 4301 return; | |
| 4302 } | |
| 4303 | |
| 4304 VisitForAccumulatorValue(args->at(1)); | |
| 4305 | |
| 4306 Register key = r3; | |
| 4307 Register cache = r4; | |
| 4308 __ LoadP(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 4309 __ LoadP(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); | |
| 4310 __ LoadP(cache, | |
| 4311 ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
| 4312 __ LoadP(cache, | |
| 4313 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id)), r0); | |
| 4314 | |
| 4315 Label done, not_found; | |
| 4316 __ LoadP(r5, FieldMemOperand(cache, JSFunctionResultCache::kFingerOffset)); | |
| 4317 // r5 now holds finger offset as a smi. | |
| 4318 __ addi(r6, cache, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 4319 // r6 now points to the start of fixed array elements. | |
| 4320 __ SmiToPtrArrayOffset(r5, r5); | |
| 4321 __ LoadPUX(r5, MemOperand(r6, r5)); | |
| 4322 // r6 now points to the key of the pair. | |
| 4323 __ cmp(key, r5); | |
| 4324 __ bne(¬_found); | |
| 4325 | |
| 4326 __ LoadP(r3, MemOperand(r6, kPointerSize)); | |
| 4327 __ b(&done); | |
| 4328 | |
| 4329 __ bind(¬_found); | |
| 4330 // Call runtime to perform the lookup. | |
| 4331 __ Push(cache, key); | |
| 4332 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
| 4333 | |
| 4334 __ bind(&done); | |
| 4335 context()->Plug(r3); | |
| 4336 } | |
| 4337 | |
| 4338 | |
| 4339 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4289 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
| 4340 ZoneList<Expression*>* args = expr->arguments(); | 4290 ZoneList<Expression*>* args = expr->arguments(); |
| 4341 VisitForAccumulatorValue(args->at(0)); | 4291 VisitForAccumulatorValue(args->at(0)); |
| 4342 | 4292 |
| 4343 Label materialize_true, materialize_false; | 4293 Label materialize_true, materialize_false; |
| 4344 Label* if_true = NULL; | 4294 Label* if_true = NULL; |
| 4345 Label* if_false = NULL; | 4295 Label* if_false = NULL; |
| 4346 Label* fall_through = NULL; | 4296 Label* fall_through = NULL; |
| 4347 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 4297 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 4348 &if_false, &fall_through); | 4298 &if_false, &fall_through); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5468 return ON_STACK_REPLACEMENT; | 5418 return ON_STACK_REPLACEMENT; |
| 5469 } | 5419 } |
| 5470 | 5420 |
| 5471 DCHECK(interrupt_address == | 5421 DCHECK(interrupt_address == |
| 5472 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5422 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5473 return OSR_AFTER_STACK_CHECK; | 5423 return OSR_AFTER_STACK_CHECK; |
| 5474 } | 5424 } |
| 5475 } // namespace internal | 5425 } // namespace internal |
| 5476 } // namespace v8 | 5426 } // namespace v8 |
| 5477 #endif // V8_TARGET_ARCH_PPC | 5427 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |