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 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 } | 3163 } |
3164 } | 3164 } |
3165 | 3165 |
3166 | 3166 |
3167 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3167 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3168 ASSERT(ToRegister(instr->context()).is(esi)); | 3168 ASSERT(ToRegister(instr->context()).is(esi)); |
3169 ASSERT(ToRegister(instr->global_object()).is(edx)); | 3169 ASSERT(ToRegister(instr->global_object()).is(edx)); |
3170 ASSERT(ToRegister(instr->result()).is(eax)); | 3170 ASSERT(ToRegister(instr->result()).is(eax)); |
3171 | 3171 |
3172 __ mov(ecx, instr->name()); | 3172 __ mov(ecx, instr->name()); |
3173 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 3173 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3174 RelocInfo::CODE_TARGET_CONTEXT; | 3174 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
3175 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3175 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3176 CallCode(ic, mode, instr); | |
3177 } | 3176 } |
3178 | 3177 |
3179 | 3178 |
3180 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 3179 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
3181 Register value = ToRegister(instr->value()); | 3180 Register value = ToRegister(instr->value()); |
3182 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); | 3181 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); |
3183 | 3182 |
3184 // If the cell we are storing to contains the hole it could have | 3183 // If the cell we are storing to contains the hole it could have |
3185 // been deleted from the property dictionary. In that case, we need | 3184 // been deleted from the property dictionary. In that case, we need |
3186 // to update the property details in the property dictionary to mark | 3185 // to update the property details in the property dictionary to mark |
3187 // it as no longer deleted. We deoptimize in that case. | 3186 // it as no longer deleted. We deoptimize in that case. |
3188 if (instr->hydrogen()->RequiresHoleCheck()) { | 3187 if (instr->hydrogen()->RequiresHoleCheck()) { |
3189 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); | 3188 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
3190 DeoptimizeIf(equal, instr->environment()); | 3189 DeoptimizeIf(equal, instr->environment()); |
3191 } | 3190 } |
3192 | 3191 |
3193 // Store the value. | 3192 // Store the value. |
3194 __ mov(Operand::ForCell(cell_handle), value); | 3193 __ mov(Operand::ForCell(cell_handle), value); |
3195 // Cells are always rescanned, so no write barrier here. | 3194 // Cells are always rescanned, so no write barrier here. |
3196 } | 3195 } |
3197 | 3196 |
3198 | 3197 |
3199 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 3198 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
3200 ASSERT(ToRegister(instr->context()).is(esi)); | 3199 ASSERT(ToRegister(instr->context()).is(esi)); |
3201 ASSERT(ToRegister(instr->global_object()).is(edx)); | 3200 ASSERT(ToRegister(instr->global_object()).is(edx)); |
3202 ASSERT(ToRegister(instr->value()).is(eax)); | 3201 ASSERT(ToRegister(instr->value()).is(eax)); |
3203 | 3202 |
3204 __ mov(ecx, instr->name()); | 3203 __ mov(ecx, instr->name()); |
3205 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3204 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
3206 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3205 instr->strict_mode_flag(), |
3207 : isolate()->builtins()->StoreIC_Initialize(); | 3206 CONTEXTUAL); |
3208 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 3207 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3209 } | 3208 } |
3210 | 3209 |
3211 | 3210 |
3212 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3211 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3213 Register context = ToRegister(instr->context()); | 3212 Register context = ToRegister(instr->context()); |
3214 Register result = ToRegister(instr->result()); | 3213 Register result = ToRegister(instr->result()); |
3215 __ mov(result, ContextOperand(context, instr->slot_index())); | 3214 __ mov(result, ContextOperand(context, instr->slot_index())); |
3216 | 3215 |
3217 if (instr->hydrogen()->RequiresHoleCheck()) { | 3216 if (instr->hydrogen()->RequiresHoleCheck()) { |
3218 __ cmp(result, factory()->the_hole_value()); | 3217 __ cmp(result, factory()->the_hole_value()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3317 } | 3316 } |
3318 } | 3317 } |
3319 | 3318 |
3320 | 3319 |
3321 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3320 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3322 ASSERT(ToRegister(instr->context()).is(esi)); | 3321 ASSERT(ToRegister(instr->context()).is(esi)); |
3323 ASSERT(ToRegister(instr->object()).is(edx)); | 3322 ASSERT(ToRegister(instr->object()).is(edx)); |
3324 ASSERT(ToRegister(instr->result()).is(eax)); | 3323 ASSERT(ToRegister(instr->result()).is(eax)); |
3325 | 3324 |
3326 __ mov(ecx, instr->name()); | 3325 __ mov(ecx, instr->name()); |
3327 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3326 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3328 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3327 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3329 } | 3328 } |
3330 | 3329 |
3331 | 3330 |
3332 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3331 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3333 Register function = ToRegister(instr->function()); | 3332 Register function = ToRegister(instr->function()); |
3334 Register temp = ToRegister(instr->temp()); | 3333 Register temp = ToRegister(instr->temp()); |
3335 Register result = ToRegister(instr->result()); | 3334 Register result = ToRegister(instr->result()); |
3336 | 3335 |
3337 // Check that the function really is a function. | 3336 // Check that the function really is a function. |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4230 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 4229 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
4231 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4230 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4232 } | 4231 } |
4233 | 4232 |
4234 | 4233 |
4235 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 4234 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
4236 ASSERT(ToRegister(instr->context()).is(esi)); | 4235 ASSERT(ToRegister(instr->context()).is(esi)); |
4237 ASSERT(ToRegister(instr->result()).is(eax)); | 4236 ASSERT(ToRegister(instr->result()).is(eax)); |
4238 | 4237 |
4239 int arity = instr->arity(); | 4238 int arity = instr->arity(); |
4240 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
4241 Handle<Code> ic = | 4239 Handle<Code> ic = |
4242 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4240 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
4243 __ mov(ecx, instr->name()); | 4241 __ mov(ecx, instr->name()); |
4244 CallCode(ic, mode, instr); | 4242 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4245 } | 4243 } |
4246 | 4244 |
4247 | 4245 |
4248 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4246 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4249 ASSERT(ToRegister(instr->context()).is(esi)); | 4247 ASSERT(ToRegister(instr->context()).is(esi)); |
4250 ASSERT(ToRegister(instr->function()).is(edi)); | 4248 ASSERT(ToRegister(instr->function()).is(edi)); |
4251 ASSERT(ToRegister(instr->result()).is(eax)); | 4249 ASSERT(ToRegister(instr->result()).is(eax)); |
4252 | 4250 |
4253 int arity = instr->arity(); | 4251 int arity = instr->arity(); |
4254 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4252 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4255 if (instr->hydrogen()->IsTailCall()) { | 4253 if (instr->hydrogen()->IsTailCall()) { |
4256 if (NeedsEagerFrame()) __ leave(); | 4254 if (NeedsEagerFrame()) __ leave(); |
4257 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 4255 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
4258 } else { | 4256 } else { |
4259 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4257 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4260 } | 4258 } |
4261 } | 4259 } |
4262 | 4260 |
4263 | 4261 |
4264 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4262 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4265 ASSERT(ToRegister(instr->context()).is(esi)); | 4263 ASSERT(ToRegister(instr->context()).is(esi)); |
4266 ASSERT(ToRegister(instr->result()).is(eax)); | 4264 ASSERT(ToRegister(instr->result()).is(eax)); |
4267 | 4265 |
4268 int arity = instr->arity(); | 4266 int arity = instr->arity(); |
4269 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
4270 Handle<Code> ic = | 4267 Handle<Code> ic = |
4271 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4268 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
4272 __ mov(ecx, instr->name()); | 4269 __ mov(ecx, instr->name()); |
4273 CallCode(ic, mode, instr); | 4270 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4274 } | 4271 } |
4275 | 4272 |
4276 | 4273 |
4277 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 4274 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
4278 ASSERT(ToRegister(instr->result()).is(eax)); | 4275 ASSERT(ToRegister(instr->result()).is(eax)); |
4279 CallKnownFunction(instr->hydrogen()->target(), | 4276 CallKnownFunction(instr->hydrogen()->target(), |
4280 instr->hydrogen()->formal_parameter_count(), | 4277 instr->hydrogen()->formal_parameter_count(), |
4281 instr->arity(), | 4278 instr->arity(), |
4282 instr, | 4279 instr, |
4283 CALL_AS_FUNCTION, | 4280 CALL_AS_FUNCTION, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4495 } | 4492 } |
4496 } | 4493 } |
4497 | 4494 |
4498 | 4495 |
4499 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4496 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4500 ASSERT(ToRegister(instr->context()).is(esi)); | 4497 ASSERT(ToRegister(instr->context()).is(esi)); |
4501 ASSERT(ToRegister(instr->object()).is(edx)); | 4498 ASSERT(ToRegister(instr->object()).is(edx)); |
4502 ASSERT(ToRegister(instr->value()).is(eax)); | 4499 ASSERT(ToRegister(instr->value()).is(eax)); |
4503 | 4500 |
4504 __ mov(ecx, instr->name()); | 4501 __ mov(ecx, instr->name()); |
4505 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4502 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
4506 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4503 instr->strict_mode_flag(), |
4507 : isolate()->builtins()->StoreIC_Initialize(); | 4504 NOT_CONTEXTUAL); |
4508 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4505 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4509 } | 4506 } |
4510 | 4507 |
4511 | 4508 |
4512 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 4509 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
4513 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4510 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
4514 Label done; | 4511 Label done; |
4515 __ j(NegateCondition(cc), &done, Label::kNear); | 4512 __ j(NegateCondition(cc), &done, Label::kNear); |
4516 __ int3(); | 4513 __ int3(); |
4517 __ bind(&done); | 4514 __ bind(&done); |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6369 FixedArray::kHeaderSize - kPointerSize)); | 6366 FixedArray::kHeaderSize - kPointerSize)); |
6370 __ bind(&done); | 6367 __ bind(&done); |
6371 } | 6368 } |
6372 | 6369 |
6373 | 6370 |
6374 #undef __ | 6371 #undef __ |
6375 | 6372 |
6376 } } // namespace v8::internal | 6373 } } // namespace v8::internal |
6377 | 6374 |
6378 #endif // V8_TARGET_ARCH_IA32 | 6375 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |