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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 4161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4172 VisitForStackValue(args->at(0)); | 4172 VisitForStackValue(args->at(0)); |
4173 VisitForStackValue(args->at(1)); | 4173 VisitForStackValue(args->at(1)); |
4174 VisitForAccumulatorValue(args->at(2)); | 4174 VisitForAccumulatorValue(args->at(2)); |
4175 __ pop(ebx); | 4175 __ pop(ebx); |
4176 __ pop(ecx); | 4176 __ pop(ecx); |
4177 __ CallStub(&stub); | 4177 __ CallStub(&stub); |
4178 context()->Plug(eax); | 4178 context()->Plug(eax); |
4179 } | 4179 } |
4180 | 4180 |
4181 | 4181 |
4182 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | |
4183 ZoneList<Expression*>* args = expr->arguments(); | |
4184 DCHECK_EQ(2, args->length()); | |
4185 | |
4186 DCHECK_NOT_NULL(args->at(0)->AsLiteral()); | |
4187 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | |
4188 | |
4189 Handle<FixedArray> jsfunction_result_caches( | |
4190 isolate()->native_context()->jsfunction_result_caches()); | |
4191 if (jsfunction_result_caches->length() <= cache_id) { | |
4192 __ Abort(kAttemptToUseUndefinedCache); | |
4193 __ mov(eax, isolate()->factory()->undefined_value()); | |
4194 context()->Plug(eax); | |
4195 return; | |
4196 } | |
4197 | |
4198 VisitForAccumulatorValue(args->at(1)); | |
4199 | |
4200 Register key = eax; | |
4201 Register cache = ebx; | |
4202 Register tmp = ecx; | |
4203 __ mov(cache, ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX)); | |
4204 __ mov(cache, | |
4205 FieldOperand(cache, GlobalObject::kNativeContextOffset)); | |
4206 __ mov(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | |
4207 __ mov(cache, | |
4208 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | |
4209 | |
4210 Label done, not_found; | |
4211 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | |
4212 __ mov(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset)); | |
4213 // tmp now holds finger offset as a smi. | |
4214 __ cmp(key, FixedArrayElementOperand(cache, tmp)); | |
4215 __ j(not_equal, ¬_found); | |
4216 | |
4217 __ mov(eax, FixedArrayElementOperand(cache, tmp, 1)); | |
4218 __ jmp(&done); | |
4219 | |
4220 __ bind(¬_found); | |
4221 // Call runtime to perform the lookup. | |
4222 __ push(cache); | |
4223 __ push(key); | |
4224 __ CallRuntime(Runtime::kGetFromCacheRT, 2); | |
4225 | |
4226 __ bind(&done); | |
4227 context()->Plug(eax); | |
4228 } | |
4229 | |
4230 | |
4231 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4182 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4232 ZoneList<Expression*>* args = expr->arguments(); | 4183 ZoneList<Expression*>* args = expr->arguments(); |
4233 DCHECK(args->length() == 1); | 4184 DCHECK(args->length() == 1); |
4234 | 4185 |
4235 VisitForAccumulatorValue(args->at(0)); | 4186 VisitForAccumulatorValue(args->at(0)); |
4236 | 4187 |
4237 __ AssertString(eax); | 4188 __ AssertString(eax); |
4238 | 4189 |
4239 Label materialize_true, materialize_false; | 4190 Label materialize_true, materialize_false; |
4240 Label* if_true = NULL; | 4191 Label* if_true = NULL; |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5384 Assembler::target_address_at(call_target_address, | 5335 Assembler::target_address_at(call_target_address, |
5385 unoptimized_code)); | 5336 unoptimized_code)); |
5386 return OSR_AFTER_STACK_CHECK; | 5337 return OSR_AFTER_STACK_CHECK; |
5387 } | 5338 } |
5388 | 5339 |
5389 | 5340 |
5390 } // namespace internal | 5341 } // namespace internal |
5391 } // namespace v8 | 5342 } // namespace v8 |
5392 | 5343 |
5393 #endif // V8_TARGET_ARCH_X87 | 5344 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |