| 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 Handle<Code> ic = instr->for_typeof() |
| 3206 RelocInfo::CODE_TARGET_CONTEXT; | 3206 ? isolate()->builtins()->LoadIC_Initialize() |
| 3207 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3207 : isolate()->builtins()->LoadIC_Initialize_Contextual(); |
| 3208 CallCode(ic, mode, instr); | 3208 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3209 } | 3209 } |
| 3210 | 3210 |
| 3211 | 3211 |
| 3212 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 3212 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 3213 Register value = ToRegister(instr->value()); | 3213 Register value = ToRegister(instr->value()); |
| 3214 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); | 3214 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); |
| 3215 | 3215 |
| 3216 // If the cell we are storing to contains the hole it could have | 3216 // 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 | 3217 // been deleted from the property dictionary. In that case, we need |
| 3218 // to update the property details in the property dictionary to mark | 3218 // to update the property details in the property dictionary to mark |
| 3219 // it as no longer deleted. We deoptimize in that case. | 3219 // it as no longer deleted. We deoptimize in that case. |
| 3220 if (instr->hydrogen()->RequiresHoleCheck()) { | 3220 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3221 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); | 3221 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
| 3222 DeoptimizeIf(equal, instr->environment()); | 3222 DeoptimizeIf(equal, instr->environment()); |
| 3223 } | 3223 } |
| 3224 | 3224 |
| 3225 // Store the value. | 3225 // Store the value. |
| 3226 __ mov(Operand::ForCell(cell_handle), value); | 3226 __ mov(Operand::ForCell(cell_handle), value); |
| 3227 // Cells are always rescanned, so no write barrier here. | 3227 // Cells are always rescanned, so no write barrier here. |
| 3228 } | 3228 } |
| 3229 | 3229 |
| 3230 | 3230 |
| 3231 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 3231 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 3232 ASSERT(ToRegister(instr->context()).is(esi)); | 3232 ASSERT(ToRegister(instr->context()).is(esi)); |
| 3233 ASSERT(ToRegister(instr->global_object()).is(edx)); | 3233 ASSERT(ToRegister(instr->global_object()).is(edx)); |
| 3234 ASSERT(ToRegister(instr->value()).is(eax)); | 3234 ASSERT(ToRegister(instr->value()).is(eax)); |
| 3235 | 3235 |
| 3236 __ mov(ecx, instr->name()); | 3236 __ mov(ecx, instr->name()); |
| 3237 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3237 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
| 3238 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3238 ? isolate()->builtins()->StoreIC_Initialize_Contextual_Strict() |
| 3239 : isolate()->builtins()->StoreIC_Initialize(); | 3239 : isolate()->builtins()->StoreIC_Initialize(); |
| 3240 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 3240 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3241 } | 3241 } |
| 3242 | 3242 |
| 3243 | 3243 |
| 3244 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3244 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 3245 Register context = ToRegister(instr->context()); | 3245 Register context = ToRegister(instr->context()); |
| 3246 Register result = ToRegister(instr->result()); | 3246 Register result = ToRegister(instr->result()); |
| 3247 __ mov(result, ContextOperand(context, instr->slot_index())); | 3247 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 3248 | 3248 |
| 3249 if (instr->hydrogen()->RequiresHoleCheck()) { | 3249 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3250 __ cmp(result, factory()->the_hole_value()); | 3250 __ cmp(result, factory()->the_hole_value()); |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4295 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 4295 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
| 4296 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4296 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4297 } | 4297 } |
| 4298 | 4298 |
| 4299 | 4299 |
| 4300 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 4300 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| 4301 ASSERT(ToRegister(instr->context()).is(esi)); | 4301 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4302 ASSERT(ToRegister(instr->result()).is(eax)); | 4302 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4303 | 4303 |
| 4304 int arity = instr->arity(); | 4304 int arity = instr->arity(); |
| 4305 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
| 4306 Handle<Code> ic = | 4305 Handle<Code> ic = |
| 4307 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4306 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
| 4308 __ mov(ecx, instr->name()); | 4307 __ mov(ecx, instr->name()); |
| 4309 CallCode(ic, mode, instr); | 4308 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4310 } | 4309 } |
| 4311 | 4310 |
| 4312 | 4311 |
| 4313 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4312 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4314 ASSERT(ToRegister(instr->context()).is(esi)); | 4313 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4315 ASSERT(ToRegister(instr->function()).is(edi)); | 4314 ASSERT(ToRegister(instr->function()).is(edi)); |
| 4316 ASSERT(ToRegister(instr->result()).is(eax)); | 4315 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4317 | 4316 |
| 4318 int arity = instr->arity(); | 4317 int arity = instr->arity(); |
| 4319 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4318 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 4320 if (instr->hydrogen()->IsTailCall()) { | 4319 if (instr->hydrogen()->IsTailCall()) { |
| 4321 if (NeedsEagerFrame()) __ leave(); | 4320 if (NeedsEagerFrame()) __ leave(); |
| 4322 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 4321 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 4323 } else { | 4322 } else { |
| 4324 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4323 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4325 } | 4324 } |
| 4326 } | 4325 } |
| 4327 | 4326 |
| 4328 | 4327 |
| 4329 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4328 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 4330 ASSERT(ToRegister(instr->context()).is(esi)); | 4329 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4331 ASSERT(ToRegister(instr->result()).is(eax)); | 4330 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4332 | 4331 |
| 4333 int arity = instr->arity(); | 4332 int arity = instr->arity(); |
| 4334 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
| 4335 Handle<Code> ic = | 4333 Handle<Code> ic = |
| 4336 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4334 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
| 4337 __ mov(ecx, instr->name()); | 4335 __ mov(ecx, instr->name()); |
| 4338 CallCode(ic, mode, instr); | 4336 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4339 } | 4337 } |
| 4340 | 4338 |
| 4341 | 4339 |
| 4342 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 4340 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
| 4343 ASSERT(ToRegister(instr->result()).is(eax)); | 4341 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4344 CallKnownFunction(instr->hydrogen()->target(), | 4342 CallKnownFunction(instr->hydrogen()->target(), |
| 4345 instr->hydrogen()->formal_parameter_count(), | 4343 instr->hydrogen()->formal_parameter_count(), |
| 4346 instr->arity(), | 4344 instr->arity(), |
| 4347 instr, | 4345 instr, |
| 4348 CALL_AS_FUNCTION, | 4346 CALL_AS_FUNCTION, |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6434 FixedArray::kHeaderSize - kPointerSize)); | 6432 FixedArray::kHeaderSize - kPointerSize)); |
| 6435 __ bind(&done); | 6433 __ bind(&done); |
| 6436 } | 6434 } |
| 6437 | 6435 |
| 6438 | 6436 |
| 6439 #undef __ | 6437 #undef __ |
| 6440 | 6438 |
| 6441 } } // namespace v8::internal | 6439 } } // namespace v8::internal |
| 6442 | 6440 |
| 6443 #endif // V8_TARGET_ARCH_IA32 | 6441 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |