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