OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6546 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 6546 ASSERT_NE(NULL, args->at(0)->AsLiteral()); |
6547 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); | 6547 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); |
6548 | 6548 |
6549 Handle<FixedArray> jsfunction_result_caches( | 6549 Handle<FixedArray> jsfunction_result_caches( |
6550 Top::global_context()->jsfunction_result_caches()); | 6550 Top::global_context()->jsfunction_result_caches()); |
6551 if (jsfunction_result_caches->length() <= cache_id) { | 6551 if (jsfunction_result_caches->length() <= cache_id) { |
6552 __ Abort("Attempt to use undefined cache."); | 6552 __ Abort("Attempt to use undefined cache."); |
6553 frame_->Push(Factory::undefined_value()); | 6553 frame_->Push(Factory::undefined_value()); |
6554 return; | 6554 return; |
6555 } | 6555 } |
6556 Handle<FixedArray> cache_obj( | |
6557 FixedArray::cast(jsfunction_result_caches->get(cache_id))); | |
6558 | 6556 |
6559 Load(args->at(1)); | 6557 Load(args->at(1)); |
6560 Result key = frame_->Pop(); | 6558 Result key = frame_->Pop(); |
6561 key.ToRegister(); | 6559 key.ToRegister(); |
6562 | 6560 |
6563 Result cache = allocator()->Allocate(); | 6561 Result cache = allocator()->Allocate(); |
6564 __ mov(cache.reg(), cache_obj); | 6562 ASSERT(cache.is_valid()); |
| 6563 __ mov(cache.reg(), ContextOperand(esi, Context::GLOBAL_INDEX)); |
| 6564 __ mov(cache.reg(), |
| 6565 FieldOperand(cache.reg(), GlobalObject::kGlobalContextOffset)); |
| 6566 __ mov(cache.reg(), |
| 6567 ContextOperand(cache.reg(), Context::JSFUNCTION_RESULT_CACHES_INDEX)); |
| 6568 __ mov(cache.reg(), |
| 6569 FieldOperand(cache.reg(), FixedArray::OffsetOfElementAt(cache_id))); |
6565 | 6570 |
6566 Result tmp = allocator()->Allocate(); | 6571 Result tmp = allocator()->Allocate(); |
| 6572 ASSERT(tmp.is_valid()); |
6567 | 6573 |
6568 DeferredSearchCache* deferred = new DeferredSearchCache(tmp.reg(), | 6574 DeferredSearchCache* deferred = new DeferredSearchCache(tmp.reg(), |
6569 cache.reg(), | 6575 cache.reg(), |
6570 key.reg()); | 6576 key.reg()); |
6571 | 6577 |
6572 const int kFingerOffset = | 6578 const int kFingerOffset = |
6573 FixedArray::OffsetOfElementAt(JSFunctionResultCache::kFingerIndex); | 6579 FixedArray::OffsetOfElementAt(JSFunctionResultCache::kFingerIndex); |
6574 // tmp.reg() now holds finger offset as a smi. | 6580 // tmp.reg() now holds finger offset as a smi. |
6575 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 6581 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
6576 __ mov(tmp.reg(), FieldOperand(cache.reg(), kFingerOffset)); | 6582 __ mov(tmp.reg(), FieldOperand(cache.reg(), kFingerOffset)); |
(...skipping 6344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12921 | 12927 |
12922 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12928 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12923 // tagged as a small integer. | 12929 // tagged as a small integer. |
12924 __ bind(&runtime); | 12930 __ bind(&runtime); |
12925 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12931 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12926 } | 12932 } |
12927 | 12933 |
12928 #undef __ | 12934 #undef __ |
12929 | 12935 |
12930 } } // namespace v8::internal | 12936 } } // namespace v8::internal |
OLD | NEW |