| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 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 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 DCHECK(args->length() == 3); | 3992 DCHECK(args->length() == 3); |
| 3993 VisitForStackValue(args->at(0)); | 3993 VisitForStackValue(args->at(0)); |
| 3994 VisitForStackValue(args->at(1)); | 3994 VisitForStackValue(args->at(1)); |
| 3995 VisitForAccumulatorValue(args->at(2)); | 3995 VisitForAccumulatorValue(args->at(2)); |
| 3996 __ Pop(x1, x2); | 3996 __ Pop(x1, x2); |
| 3997 __ CallStub(&stub); | 3997 __ CallStub(&stub); |
| 3998 context()->Plug(x0); | 3998 context()->Plug(x0); |
| 3999 } | 3999 } |
| 4000 | 4000 |
| 4001 | 4001 |
| 4002 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | |
| 4003 ZoneList<Expression*>* args = expr->arguments(); | |
| 4004 DCHECK_EQ(2, args->length()); | |
| 4005 DCHECK_NOT_NULL(args->at(0)->AsLiteral()); | |
| 4006 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | |
| 4007 | |
| 4008 Handle<FixedArray> jsfunction_result_caches( | |
| 4009 isolate()->native_context()->jsfunction_result_caches()); | |
| 4010 if (jsfunction_result_caches->length() <= cache_id) { | |
| 4011 __ Abort(kAttemptToUseUndefinedCache); | |
| 4012 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); | |
| 4013 context()->Plug(x0); | |
| 4014 return; | |
| 4015 } | |
| 4016 | |
| 4017 VisitForAccumulatorValue(args->at(1)); | |
| 4018 | |
| 4019 Register key = x0; | |
| 4020 Register cache = x1; | |
| 4021 __ Ldr(cache, GlobalObjectMemOperand()); | |
| 4022 __ Ldr(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); | |
| 4023 __ Ldr(cache, ContextMemOperand(cache, | |
| 4024 Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
| 4025 __ Ldr(cache, | |
| 4026 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | |
| 4027 | |
| 4028 Label done; | |
| 4029 __ Ldrsw(x2, UntagSmiFieldMemOperand(cache, | |
| 4030 JSFunctionResultCache::kFingerOffset)); | |
| 4031 __ Add(x3, cache, FixedArray::kHeaderSize - kHeapObjectTag); | |
| 4032 __ Add(x3, x3, Operand(x2, LSL, kPointerSizeLog2)); | |
| 4033 | |
| 4034 // Load the key and data from the cache. | |
| 4035 __ Ldp(x2, x3, MemOperand(x3)); | |
| 4036 | |
| 4037 __ Cmp(key, x2); | |
| 4038 __ CmovX(x0, x3, eq); | |
| 4039 __ B(eq, &done); | |
| 4040 | |
| 4041 // Call runtime to perform the lookup. | |
| 4042 __ Push(cache, key); | |
| 4043 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
| 4044 | |
| 4045 __ Bind(&done); | |
| 4046 context()->Plug(x0); | |
| 4047 } | |
| 4048 | |
| 4049 | |
| 4050 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4002 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
| 4051 ZoneList<Expression*>* args = expr->arguments(); | 4003 ZoneList<Expression*>* args = expr->arguments(); |
| 4052 VisitForAccumulatorValue(args->at(0)); | 4004 VisitForAccumulatorValue(args->at(0)); |
| 4053 | 4005 |
| 4054 Label materialize_true, materialize_false; | 4006 Label materialize_true, materialize_false; |
| 4055 Label* if_true = NULL; | 4007 Label* if_true = NULL; |
| 4056 Label* if_false = NULL; | 4008 Label* if_false = NULL; |
| 4057 Label* fall_through = NULL; | 4009 Label* fall_through = NULL; |
| 4058 context()->PrepareTest(&materialize_true, &materialize_false, | 4010 context()->PrepareTest(&materialize_true, &materialize_false, |
| 4059 &if_true, &if_false, &fall_through); | 4011 &if_true, &if_false, &fall_through); |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5511 } | 5463 } |
| 5512 | 5464 |
| 5513 return INTERRUPT; | 5465 return INTERRUPT; |
| 5514 } | 5466 } |
| 5515 | 5467 |
| 5516 | 5468 |
| 5517 } // namespace internal | 5469 } // namespace internal |
| 5518 } // namespace v8 | 5470 } // namespace v8 |
| 5519 | 5471 |
| 5520 #endif // V8_TARGET_ARCH_ARM64 | 5472 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |