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 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 4298 ASSERT_NE(NULL, args->at(0)->AsLiteral()); |
4299 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); | 4299 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); |
4300 | 4300 |
4301 Handle<FixedArray> jsfunction_result_caches( | 4301 Handle<FixedArray> jsfunction_result_caches( |
4302 Top::global_context()->jsfunction_result_caches()); | 4302 Top::global_context()->jsfunction_result_caches()); |
4303 if (jsfunction_result_caches->length() <= cache_id) { | 4303 if (jsfunction_result_caches->length() <= cache_id) { |
4304 __ Abort("Attempt to use undefined cache."); | 4304 __ Abort("Attempt to use undefined cache."); |
4305 frame_->Push(Factory::undefined_value()); | 4305 frame_->Push(Factory::undefined_value()); |
4306 return; | 4306 return; |
4307 } | 4307 } |
4308 Handle<FixedArray> cache_obj( | |
4309 FixedArray::cast(jsfunction_result_caches->get(cache_id))); | |
4310 | 4308 |
4311 Load(args->at(1)); | 4309 Load(args->at(1)); |
4312 Result key = frame_->Pop(); | 4310 Result key = frame_->Pop(); |
4313 key.ToRegister(); | 4311 key.ToRegister(); |
4314 | 4312 |
4315 Result cache = allocator()->Allocate(); | 4313 Result cache = allocator()->Allocate(); |
4316 __ movq(cache.reg(), cache_obj, RelocInfo::EMBEDDED_OBJECT); | 4314 ASSERT(cache.is_valid()); |
| 4315 __ movq(cache.reg(), ContextOperand(rsi, Context::GLOBAL_INDEX)); |
| 4316 __ movq(cache.reg(), |
| 4317 FieldOperand(cache.reg(), GlobalObject::kGlobalContextOffset)); |
| 4318 __ movq(cache.reg(), |
| 4319 ContextOperand(cache.reg(), Context::JSFUNCTION_RESULT_CACHES_INDEX)); |
| 4320 __ movq(cache.reg(), |
| 4321 FieldOperand(cache.reg(), FixedArray::OffsetOfElementAt(cache_id))); |
4317 | 4322 |
4318 Result tmp = allocator()->Allocate(); | 4323 Result tmp = allocator()->Allocate(); |
| 4324 ASSERT(tmp.is_valid()); |
4319 | 4325 |
4320 DeferredSearchCache* deferred = new DeferredSearchCache(tmp.reg(), | 4326 DeferredSearchCache* deferred = new DeferredSearchCache(tmp.reg(), |
4321 cache.reg(), | 4327 cache.reg(), |
4322 key.reg()); | 4328 key.reg()); |
4323 | 4329 |
4324 const int kFingerOffset = | 4330 const int kFingerOffset = |
4325 FixedArray::OffsetOfElementAt(JSFunctionResultCache::kFingerIndex); | 4331 FixedArray::OffsetOfElementAt(JSFunctionResultCache::kFingerIndex); |
4326 // tmp.reg() now holds finger offset as a smi. | 4332 // tmp.reg() now holds finger offset as a smi. |
4327 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 4333 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
4328 __ movq(tmp.reg(), FieldOperand(cache.reg(), kFingerOffset)); | 4334 __ movq(tmp.reg(), FieldOperand(cache.reg(), kFingerOffset)); |
(...skipping 6150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10479 // Call the function from C++. | 10485 // Call the function from C++. |
10480 return FUNCTION_CAST<ModuloFunction>(buffer); | 10486 return FUNCTION_CAST<ModuloFunction>(buffer); |
10481 } | 10487 } |
10482 | 10488 |
10483 #endif | 10489 #endif |
10484 | 10490 |
10485 | 10491 |
10486 #undef __ | 10492 #undef __ |
10487 | 10493 |
10488 } } // namespace v8::internal | 10494 } } // namespace v8::internal |
OLD | NEW |