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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4181 VisitForStackValue(args->at(0)); | 4181 VisitForStackValue(args->at(0)); |
4182 VisitForStackValue(args->at(1)); | 4182 VisitForStackValue(args->at(1)); |
4183 VisitForAccumulatorValue(args->at(2)); | 4183 VisitForAccumulatorValue(args->at(2)); |
4184 __ pop(ebx); | 4184 __ pop(ebx); |
4185 __ pop(ecx); | 4185 __ pop(ecx); |
4186 __ CallStub(&stub); | 4186 __ CallStub(&stub); |
4187 context()->Plug(eax); | 4187 context()->Plug(eax); |
4188 } | 4188 } |
4189 | 4189 |
4190 | 4190 |
4191 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | |
4192 ZoneList<Expression*>* args = expr->arguments(); | |
4193 DCHECK_EQ(2, args->length()); | |
4194 | |
4195 DCHECK_NOT_NULL(args->at(0)->AsLiteral()); | |
4196 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | |
4197 | |
4198 Handle<FixedArray> jsfunction_result_caches( | |
4199 isolate()->native_context()->jsfunction_result_caches()); | |
4200 if (jsfunction_result_caches->length() <= cache_id) { | |
4201 __ Abort(kAttemptToUseUndefinedCache); | |
4202 __ mov(eax, isolate()->factory()->undefined_value()); | |
4203 context()->Plug(eax); | |
4204 return; | |
4205 } | |
4206 | |
4207 VisitForAccumulatorValue(args->at(1)); | |
4208 | |
4209 Register key = eax; | |
4210 Register cache = ebx; | |
4211 Register tmp = ecx; | |
4212 __ mov(cache, ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX)); | |
4213 __ mov(cache, | |
4214 FieldOperand(cache, GlobalObject::kNativeContextOffset)); | |
4215 __ mov(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
4216 __ mov(cache, | |
4217 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | |
4218 | |
4219 Label done, not_found; | |
4220 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | |
4221 __ mov(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset)); | |
4222 // tmp now holds finger offset as a smi. | |
4223 __ cmp(key, FixedArrayElementOperand(cache, tmp)); | |
4224 __ j(not_equal, ¬_found); | |
4225 | |
4226 __ mov(eax, FixedArrayElementOperand(cache, tmp, 1)); | |
4227 __ jmp(&done); | |
4228 | |
4229 __ bind(¬_found); | |
4230 // Call runtime to perform the lookup. | |
4231 __ push(cache); | |
4232 __ push(key); | |
4233 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
4234 | |
4235 __ bind(&done); | |
4236 context()->Plug(eax); | |
4237 } | |
4238 | |
4239 | |
4240 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4191 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4241 ZoneList<Expression*>* args = expr->arguments(); | 4192 ZoneList<Expression*>* args = expr->arguments(); |
4242 DCHECK(args->length() == 1); | 4193 DCHECK(args->length() == 1); |
4243 | 4194 |
4244 VisitForAccumulatorValue(args->at(0)); | 4195 VisitForAccumulatorValue(args->at(0)); |
4245 | 4196 |
4246 __ AssertString(eax); | 4197 __ AssertString(eax); |
4247 | 4198 |
4248 Label materialize_true, materialize_false; | 4199 Label materialize_true, materialize_false; |
4249 Label* if_true = NULL; | 4200 Label* if_true = NULL; |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5393 Assembler::target_address_at(call_target_address, | 5344 Assembler::target_address_at(call_target_address, |
5394 unoptimized_code)); | 5345 unoptimized_code)); |
5395 return OSR_AFTER_STACK_CHECK; | 5346 return OSR_AFTER_STACK_CHECK; |
5396 } | 5347 } |
5397 | 5348 |
5398 | 5349 |
5399 } // namespace internal | 5350 } // namespace internal |
5400 } // namespace v8 | 5351 } // namespace v8 |
5401 | 5352 |
5402 #endif // V8_TARGET_ARCH_IA32 | 5353 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |