| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4303 VisitForStackValue(args->at(1)); | 4303 VisitForStackValue(args->at(1)); |
| 4304 VisitForAccumulatorValue(args->at(2)); | 4304 VisitForAccumulatorValue(args->at(2)); |
| 4305 __ mov(a0, result_register()); | 4305 __ mov(a0, result_register()); |
| 4306 __ pop(a1); | 4306 __ pop(a1); |
| 4307 __ pop(a2); | 4307 __ pop(a2); |
| 4308 __ CallStub(&stub); | 4308 __ CallStub(&stub); |
| 4309 context()->Plug(v0); | 4309 context()->Plug(v0); |
| 4310 } | 4310 } |
| 4311 | 4311 |
| 4312 | 4312 |
| 4313 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | |
| 4314 ZoneList<Expression*>* args = expr->arguments(); | |
| 4315 DCHECK_EQ(2, args->length()); | |
| 4316 | |
| 4317 DCHECK_NOT_NULL(args->at(0)->AsLiteral()); | |
| 4318 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | |
| 4319 | |
| 4320 Handle<FixedArray> jsfunction_result_caches( | |
| 4321 isolate()->native_context()->jsfunction_result_caches()); | |
| 4322 if (jsfunction_result_caches->length() <= cache_id) { | |
| 4323 __ Abort(kAttemptToUseUndefinedCache); | |
| 4324 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | |
| 4325 context()->Plug(v0); | |
| 4326 return; | |
| 4327 } | |
| 4328 | |
| 4329 VisitForAccumulatorValue(args->at(1)); | |
| 4330 | |
| 4331 Register key = v0; | |
| 4332 Register cache = a1; | |
| 4333 __ ld(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 4334 __ ld(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset)); | |
| 4335 __ ld(cache, | |
| 4336 ContextOperand( | |
| 4337 cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
| 4338 __ ld(cache, | |
| 4339 FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | |
| 4340 | |
| 4341 | |
| 4342 Label done, not_found; | |
| 4343 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | |
| 4344 __ ld(a2, FieldMemOperand(cache, JSFunctionResultCache::kFingerOffset)); | |
| 4345 // a2 now holds finger offset as a smi. | |
| 4346 __ Daddu(a3, cache, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 4347 // a3 now points to the start of fixed array elements. | |
| 4348 __ SmiScale(at, a2, kPointerSizeLog2); | |
| 4349 __ daddu(a3, a3, at); | |
| 4350 // a3 now points to key of indexed element of cache. | |
| 4351 __ ld(a2, MemOperand(a3)); | |
| 4352 __ Branch(¬_found, ne, key, Operand(a2)); | |
| 4353 | |
| 4354 __ ld(v0, MemOperand(a3, kPointerSize)); | |
| 4355 __ Branch(&done); | |
| 4356 | |
| 4357 __ bind(¬_found); | |
| 4358 // Call runtime to perform the lookup. | |
| 4359 __ Push(cache, key); | |
| 4360 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
| 4361 | |
| 4362 __ bind(&done); | |
| 4363 context()->Plug(v0); | |
| 4364 } | |
| 4365 | |
| 4366 | |
| 4367 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4313 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
| 4368 ZoneList<Expression*>* args = expr->arguments(); | 4314 ZoneList<Expression*>* args = expr->arguments(); |
| 4369 VisitForAccumulatorValue(args->at(0)); | 4315 VisitForAccumulatorValue(args->at(0)); |
| 4370 | 4316 |
| 4371 Label materialize_true, materialize_false; | 4317 Label materialize_true, materialize_false; |
| 4372 Label* if_true = NULL; | 4318 Label* if_true = NULL; |
| 4373 Label* if_false = NULL; | 4319 Label* if_false = NULL; |
| 4374 Label* fall_through = NULL; | 4320 Label* fall_through = NULL; |
| 4375 context()->PrepareTest(&materialize_true, &materialize_false, | 4321 context()->PrepareTest(&materialize_true, &materialize_false, |
| 4376 &if_true, &if_false, &fall_through); | 4322 &if_true, &if_false, &fall_through); |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5491 reinterpret_cast<uint64_t>( | 5437 reinterpret_cast<uint64_t>( |
| 5492 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5438 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5493 return OSR_AFTER_STACK_CHECK; | 5439 return OSR_AFTER_STACK_CHECK; |
| 5494 } | 5440 } |
| 5495 | 5441 |
| 5496 | 5442 |
| 5497 } // namespace internal | 5443 } // namespace internal |
| 5498 } // namespace v8 | 5444 } // namespace v8 |
| 5499 | 5445 |
| 5500 #endif // V8_TARGET_ARCH_MIPS64 | 5446 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |