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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 VisitForStackValue(args->at(0)); | 4279 VisitForStackValue(args->at(0)); |
4280 VisitForStackValue(args->at(1)); | 4280 VisitForStackValue(args->at(1)); |
4281 VisitForAccumulatorValue(args->at(2)); | 4281 VisitForAccumulatorValue(args->at(2)); |
4282 __ pop(r1); | 4282 __ pop(r1); |
4283 __ pop(r2); | 4283 __ pop(r2); |
4284 __ CallStub(&stub); | 4284 __ CallStub(&stub); |
4285 context()->Plug(r0); | 4285 context()->Plug(r0); |
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(r0, Heap::kUndefinedValueRootIndex); | |
4300 context()->Plug(r0); | |
4301 return; | |
4302 } | |
4303 | |
4304 VisitForAccumulatorValue(args->at(1)); | |
4305 | |
4306 Register key = r0; | |
4307 Register cache = r1; | |
4308 __ ldr(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
4309 __ ldr(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); | |
4310 __ ldr(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
4311 __ ldr(cache, | |
4312 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | |
4313 | |
4314 | |
4315 Label done, not_found; | |
4316 __ ldr(r2, FieldMemOperand(cache, JSFunctionResultCache::kFingerOffset)); | |
4317 // r2 now holds finger offset as a smi. | |
4318 __ add(r3, cache, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
4319 // r3 now points to the start of fixed array elements. | |
4320 __ ldr(r2, MemOperand::PointerAddressFromSmiKey(r3, r2, PreIndex)); | |
4321 // Note side effect of PreIndex: r3 now points to the key of the pair. | |
4322 __ cmp(key, r2); | |
4323 __ b(ne, ¬_found); | |
4324 | |
4325 __ ldr(r0, MemOperand(r3, kPointerSize)); | |
4326 __ b(&done); | |
4327 | |
4328 __ bind(¬_found); | |
4329 // Call runtime to perform the lookup. | |
4330 __ Push(cache, key); | |
4331 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
4332 | |
4333 __ bind(&done); | |
4334 context()->Plug(r0); | |
4335 } | |
4336 | |
4337 | |
4338 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4289 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4339 ZoneList<Expression*>* args = expr->arguments(); | 4290 ZoneList<Expression*>* args = expr->arguments(); |
4340 VisitForAccumulatorValue(args->at(0)); | 4291 VisitForAccumulatorValue(args->at(0)); |
4341 | 4292 |
4342 Label materialize_true, materialize_false; | 4293 Label materialize_true, materialize_false; |
4343 Label* if_true = NULL; | 4294 Label* if_true = NULL; |
4344 Label* if_false = NULL; | 4295 Label* if_false = NULL; |
4345 Label* fall_through = NULL; | 4296 Label* fall_through = NULL; |
4346 context()->PrepareTest(&materialize_true, &materialize_false, | 4297 context()->PrepareTest(&materialize_true, &materialize_false, |
4347 &if_true, &if_false, &fall_through); | 4298 &if_true, &if_false, &fall_through); |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5519 DCHECK(interrupt_address == | 5470 DCHECK(interrupt_address == |
5520 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5471 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5521 return OSR_AFTER_STACK_CHECK; | 5472 return OSR_AFTER_STACK_CHECK; |
5522 } | 5473 } |
5523 | 5474 |
5524 | 5475 |
5525 } // namespace internal | 5476 } // namespace internal |
5526 } // namespace v8 | 5477 } // namespace v8 |
5527 | 5478 |
5528 #endif // V8_TARGET_ARCH_ARM | 5479 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |