OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3195 } | 3195 } |
3196 } | 3196 } |
3197 | 3197 |
3198 | 3198 |
3199 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3199 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3200 ASSERT(ToRegister(instr->context()).is(esi)); | 3200 ASSERT(ToRegister(instr->context()).is(esi)); |
3201 ASSERT(ToRegister(instr->global_object()).is(edx)); | 3201 ASSERT(ToRegister(instr->global_object()).is(edx)); |
3202 ASSERT(ToRegister(instr->result()).is(eax)); | 3202 ASSERT(ToRegister(instr->result()).is(eax)); |
3203 | 3203 |
3204 __ mov(ecx, instr->name()); | 3204 __ mov(ecx, instr->name()); |
3205 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 3205 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3206 RelocInfo::CODE_TARGET_CONTEXT; | 3206 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
3207 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3207 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3208 CallCode(ic, mode, instr); | |
3209 } | 3208 } |
3210 | 3209 |
3211 | 3210 |
3212 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 3211 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
3213 Register value = ToRegister(instr->value()); | 3212 Register value = ToRegister(instr->value()); |
3214 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); | 3213 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); |
3215 | 3214 |
3216 // If the cell we are storing to contains the hole it could have | 3215 // If the cell we are storing to contains the hole it could have |
3217 // been deleted from the property dictionary. In that case, we need | 3216 // been deleted from the property dictionary. In that case, we need |
3218 // to update the property details in the property dictionary to mark | 3217 // to update the property details in the property dictionary to mark |
3219 // it as no longer deleted. We deoptimize in that case. | 3218 // it as no longer deleted. We deoptimize in that case. |
3220 if (instr->hydrogen()->RequiresHoleCheck()) { | 3219 if (instr->hydrogen()->RequiresHoleCheck()) { |
3221 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); | 3220 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
3222 DeoptimizeIf(equal, instr->environment()); | 3221 DeoptimizeIf(equal, instr->environment()); |
3223 } | 3222 } |
3224 | 3223 |
3225 // Store the value. | 3224 // Store the value. |
3226 __ mov(Operand::ForCell(cell_handle), value); | 3225 __ mov(Operand::ForCell(cell_handle), value); |
3227 // Cells are always rescanned, so no write barrier here. | 3226 // Cells are always rescanned, so no write barrier here. |
3228 } | 3227 } |
3229 | 3228 |
3230 | 3229 |
3231 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 3230 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
3232 ASSERT(ToRegister(instr->context()).is(esi)); | 3231 ASSERT(ToRegister(instr->context()).is(esi)); |
3233 ASSERT(ToRegister(instr->global_object()).is(edx)); | 3232 ASSERT(ToRegister(instr->global_object()).is(edx)); |
3234 ASSERT(ToRegister(instr->value()).is(eax)); | 3233 ASSERT(ToRegister(instr->value()).is(eax)); |
3235 | 3234 |
3236 __ mov(ecx, instr->name()); | 3235 __ mov(ecx, instr->name()); |
3237 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3236 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
3238 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3237 instr->strict_mode_flag(), |
3239 : isolate()->builtins()->StoreIC_Initialize(); | 3238 CONTEXTUAL); |
3240 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 3239 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3241 } | 3240 } |
3242 | 3241 |
3243 | 3242 |
3244 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3243 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3245 Register context = ToRegister(instr->context()); | 3244 Register context = ToRegister(instr->context()); |
3246 Register result = ToRegister(instr->result()); | 3245 Register result = ToRegister(instr->result()); |
3247 __ mov(result, ContextOperand(context, instr->slot_index())); | 3246 __ mov(result, ContextOperand(context, instr->slot_index())); |
3248 | 3247 |
3249 if (instr->hydrogen()->RequiresHoleCheck()) { | 3248 if (instr->hydrogen()->RequiresHoleCheck()) { |
3250 __ cmp(result, factory()->the_hole_value()); | 3249 __ cmp(result, factory()->the_hole_value()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 } | 3348 } |
3350 } | 3349 } |
3351 | 3350 |
3352 | 3351 |
3353 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3352 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3354 ASSERT(ToRegister(instr->context()).is(esi)); | 3353 ASSERT(ToRegister(instr->context()).is(esi)); |
3355 ASSERT(ToRegister(instr->object()).is(edx)); | 3354 ASSERT(ToRegister(instr->object()).is(edx)); |
3356 ASSERT(ToRegister(instr->result()).is(eax)); | 3355 ASSERT(ToRegister(instr->result()).is(eax)); |
3357 | 3356 |
3358 __ mov(ecx, instr->name()); | 3357 __ mov(ecx, instr->name()); |
3359 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3358 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3360 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3359 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3361 } | 3360 } |
3362 | 3361 |
3363 | 3362 |
3364 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3363 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3365 Register function = ToRegister(instr->function()); | 3364 Register function = ToRegister(instr->function()); |
3366 Register temp = ToRegister(instr->temp()); | 3365 Register temp = ToRegister(instr->temp()); |
3367 Register result = ToRegister(instr->result()); | 3366 Register result = ToRegister(instr->result()); |
3368 | 3367 |
3369 // Check that the function really is a function. | 3368 // Check that the function really is a function. |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 4294 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
4296 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4295 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4297 } | 4296 } |
4298 | 4297 |
4299 | 4298 |
4300 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 4299 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
4301 ASSERT(ToRegister(instr->context()).is(esi)); | 4300 ASSERT(ToRegister(instr->context()).is(esi)); |
4302 ASSERT(ToRegister(instr->result()).is(eax)); | 4301 ASSERT(ToRegister(instr->result()).is(eax)); |
4303 | 4302 |
4304 int arity = instr->arity(); | 4303 int arity = instr->arity(); |
4305 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
4306 Handle<Code> ic = | 4304 Handle<Code> ic = |
4307 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4305 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
4308 __ mov(ecx, instr->name()); | 4306 __ mov(ecx, instr->name()); |
4309 CallCode(ic, mode, instr); | 4307 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4310 } | 4308 } |
4311 | 4309 |
4312 | 4310 |
4313 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4311 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4314 ASSERT(ToRegister(instr->context()).is(esi)); | 4312 ASSERT(ToRegister(instr->context()).is(esi)); |
4315 ASSERT(ToRegister(instr->function()).is(edi)); | 4313 ASSERT(ToRegister(instr->function()).is(edi)); |
4316 ASSERT(ToRegister(instr->result()).is(eax)); | 4314 ASSERT(ToRegister(instr->result()).is(eax)); |
4317 | 4315 |
4318 int arity = instr->arity(); | 4316 int arity = instr->arity(); |
4319 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4317 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4320 if (instr->hydrogen()->IsTailCall()) { | 4318 if (instr->hydrogen()->IsTailCall()) { |
4321 if (NeedsEagerFrame()) __ leave(); | 4319 if (NeedsEagerFrame()) __ leave(); |
4322 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 4320 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
4323 } else { | 4321 } else { |
4324 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4322 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4325 } | 4323 } |
4326 } | 4324 } |
4327 | 4325 |
4328 | 4326 |
4329 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4327 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4330 ASSERT(ToRegister(instr->context()).is(esi)); | 4328 ASSERT(ToRegister(instr->context()).is(esi)); |
4331 ASSERT(ToRegister(instr->result()).is(eax)); | 4329 ASSERT(ToRegister(instr->result()).is(eax)); |
4332 | 4330 |
4333 int arity = instr->arity(); | 4331 int arity = instr->arity(); |
4334 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
4335 Handle<Code> ic = | 4332 Handle<Code> ic = |
4336 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4333 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
4337 __ mov(ecx, instr->name()); | 4334 __ mov(ecx, instr->name()); |
4338 CallCode(ic, mode, instr); | 4335 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4339 } | 4336 } |
4340 | 4337 |
4341 | 4338 |
4342 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 4339 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
4343 ASSERT(ToRegister(instr->result()).is(eax)); | 4340 ASSERT(ToRegister(instr->result()).is(eax)); |
4344 CallKnownFunction(instr->hydrogen()->target(), | 4341 CallKnownFunction(instr->hydrogen()->target(), |
4345 instr->hydrogen()->formal_parameter_count(), | 4342 instr->hydrogen()->formal_parameter_count(), |
4346 instr->arity(), | 4343 instr->arity(), |
4347 instr, | 4344 instr, |
4348 CALL_AS_FUNCTION, | 4345 CALL_AS_FUNCTION, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4560 } | 4557 } |
4561 } | 4558 } |
4562 | 4559 |
4563 | 4560 |
4564 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4561 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4565 ASSERT(ToRegister(instr->context()).is(esi)); | 4562 ASSERT(ToRegister(instr->context()).is(esi)); |
4566 ASSERT(ToRegister(instr->object()).is(edx)); | 4563 ASSERT(ToRegister(instr->object()).is(edx)); |
4567 ASSERT(ToRegister(instr->value()).is(eax)); | 4564 ASSERT(ToRegister(instr->value()).is(eax)); |
4568 | 4565 |
4569 __ mov(ecx, instr->name()); | 4566 __ mov(ecx, instr->name()); |
4570 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4567 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
4571 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4568 instr->strict_mode_flag(), |
4572 : isolate()->builtins()->StoreIC_Initialize(); | 4569 NOT_CONTEXTUAL); |
4573 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4570 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4574 } | 4571 } |
4575 | 4572 |
4576 | 4573 |
4577 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 4574 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
4578 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4575 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
4579 Label done; | 4576 Label done; |
4580 __ j(NegateCondition(cc), &done, Label::kNear); | 4577 __ j(NegateCondition(cc), &done, Label::kNear); |
4581 __ int3(); | 4578 __ int3(); |
4582 __ bind(&done); | 4579 __ bind(&done); |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6434 FixedArray::kHeaderSize - kPointerSize)); | 6431 FixedArray::kHeaderSize - kPointerSize)); |
6435 __ bind(&done); | 6432 __ bind(&done); |
6436 } | 6433 } |
6437 | 6434 |
6438 | 6435 |
6439 #undef __ | 6436 #undef __ |
6440 | 6437 |
6441 } } // namespace v8::internal | 6438 } } // namespace v8::internal |
6442 | 6439 |
6443 #endif // V8_TARGET_ARCH_IA32 | 6440 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |