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 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2961 } | 2961 } |
2962 } | 2962 } |
2963 | 2963 |
2964 | 2964 |
2965 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2965 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2966 ASSERT(ToRegister(instr->context()).is(cp)); | 2966 ASSERT(ToRegister(instr->context()).is(cp)); |
2967 ASSERT(ToRegister(instr->global_object()).is(r0)); | 2967 ASSERT(ToRegister(instr->global_object()).is(r0)); |
2968 ASSERT(ToRegister(instr->result()).is(r0)); | 2968 ASSERT(ToRegister(instr->result()).is(r0)); |
2969 | 2969 |
2970 __ mov(r2, Operand(instr->name())); | 2970 __ mov(r2, Operand(instr->name())); |
2971 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET | 2971 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2972 : RelocInfo::CODE_TARGET_CONTEXT; | 2972 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
2973 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2973 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2974 CallCode(ic, mode, instr); | |
2975 } | 2974 } |
2976 | 2975 |
2977 | 2976 |
2978 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2977 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2979 Register value = ToRegister(instr->value()); | 2978 Register value = ToRegister(instr->value()); |
2980 Register cell = scratch0(); | 2979 Register cell = scratch0(); |
2981 | 2980 |
2982 // Load the cell. | 2981 // Load the cell. |
2983 __ mov(cell, Operand(instr->hydrogen()->cell().handle())); | 2982 __ mov(cell, Operand(instr->hydrogen()->cell().handle())); |
2984 | 2983 |
(...skipping 14 matching lines...) Expand all Loading... |
2999 // Cells are always rescanned, so no write barrier here. | 2998 // Cells are always rescanned, so no write barrier here. |
3000 } | 2999 } |
3001 | 3000 |
3002 | 3001 |
3003 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 3002 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
3004 ASSERT(ToRegister(instr->context()).is(cp)); | 3003 ASSERT(ToRegister(instr->context()).is(cp)); |
3005 ASSERT(ToRegister(instr->global_object()).is(r1)); | 3004 ASSERT(ToRegister(instr->global_object()).is(r1)); |
3006 ASSERT(ToRegister(instr->value()).is(r0)); | 3005 ASSERT(ToRegister(instr->value()).is(r0)); |
3007 | 3006 |
3008 __ mov(r2, Operand(instr->name())); | 3007 __ mov(r2, Operand(instr->name())); |
3009 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3008 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
3010 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3009 instr->strict_mode_flag(), |
3011 : isolate()->builtins()->StoreIC_Initialize(); | 3010 CONTEXTUAL); |
3012 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 3011 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3013 } | 3012 } |
3014 | 3013 |
3015 | 3014 |
3016 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3015 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3017 Register context = ToRegister(instr->context()); | 3016 Register context = ToRegister(instr->context()); |
3018 Register result = ToRegister(instr->result()); | 3017 Register result = ToRegister(instr->result()); |
3019 __ ldr(result, ContextOperand(context, instr->slot_index())); | 3018 __ ldr(result, ContextOperand(context, instr->slot_index())); |
3020 if (instr->hydrogen()->RequiresHoleCheck()) { | 3019 if (instr->hydrogen()->RequiresHoleCheck()) { |
3021 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3020 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3022 __ cmp(result, ip); | 3021 __ cmp(result, ip); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3095 } | 3094 } |
3096 | 3095 |
3097 | 3096 |
3098 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3097 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3099 ASSERT(ToRegister(instr->context()).is(cp)); | 3098 ASSERT(ToRegister(instr->context()).is(cp)); |
3100 ASSERT(ToRegister(instr->object()).is(r0)); | 3099 ASSERT(ToRegister(instr->object()).is(r0)); |
3101 ASSERT(ToRegister(instr->result()).is(r0)); | 3100 ASSERT(ToRegister(instr->result()).is(r0)); |
3102 | 3101 |
3103 // Name is always in r2. | 3102 // Name is always in r2. |
3104 __ mov(r2, Operand(instr->name())); | 3103 __ mov(r2, Operand(instr->name())); |
3105 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3104 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3106 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3105 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3107 } | 3106 } |
3108 | 3107 |
3109 | 3108 |
3110 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3109 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3111 Register scratch = scratch0(); | 3110 Register scratch = scratch0(); |
3112 Register function = ToRegister(instr->function()); | 3111 Register function = ToRegister(instr->function()); |
3113 Register result = ToRegister(instr->result()); | 3112 Register result = ToRegister(instr->result()); |
3114 | 3113 |
3115 // Check that the function really is a function. Load map into the | 3114 // Check that the function really is a function. Load map into the |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3982 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3981 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
3983 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3982 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3984 } | 3983 } |
3985 | 3984 |
3986 | 3985 |
3987 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3986 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
3988 ASSERT(ToRegister(instr->context()).is(cp)); | 3987 ASSERT(ToRegister(instr->context()).is(cp)); |
3989 ASSERT(ToRegister(instr->result()).is(r0)); | 3988 ASSERT(ToRegister(instr->result()).is(r0)); |
3990 | 3989 |
3991 int arity = instr->arity(); | 3990 int arity = instr->arity(); |
3992 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
3993 Handle<Code> ic = | 3991 Handle<Code> ic = |
3994 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3992 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
3995 __ mov(r2, Operand(instr->name())); | 3993 __ mov(r2, Operand(instr->name())); |
3996 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 3994 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3997 } | 3995 } |
3998 | 3996 |
3999 | 3997 |
4000 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3998 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4001 ASSERT(ToRegister(instr->context()).is(cp)); | 3999 ASSERT(ToRegister(instr->context()).is(cp)); |
4002 ASSERT(ToRegister(instr->function()).is(r1)); | 4000 ASSERT(ToRegister(instr->function()).is(r1)); |
4003 ASSERT(ToRegister(instr->result()).is(r0)); | 4001 ASSERT(ToRegister(instr->result()).is(r0)); |
4004 | 4002 |
4005 int arity = instr->arity(); | 4003 int arity = instr->arity(); |
4006 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4004 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4007 if (instr->hydrogen()->IsTailCall()) { | 4005 if (instr->hydrogen()->IsTailCall()) { |
4008 if (NeedsEagerFrame()) __ mov(sp, fp); | 4006 if (NeedsEagerFrame()) __ mov(sp, fp); |
4009 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 4007 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
4010 } else { | 4008 } else { |
4011 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4009 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4012 } | 4010 } |
4013 } | 4011 } |
4014 | 4012 |
4015 | 4013 |
4016 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 4014 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
4017 ASSERT(ToRegister(instr->context()).is(cp)); | 4015 ASSERT(ToRegister(instr->context()).is(cp)); |
4018 ASSERT(ToRegister(instr->result()).is(r0)); | 4016 ASSERT(ToRegister(instr->result()).is(r0)); |
4019 | 4017 |
4020 int arity = instr->arity(); | 4018 int arity = instr->arity(); |
4021 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
4022 Handle<Code> ic = | 4019 Handle<Code> ic = |
4023 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4020 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
4024 __ mov(r2, Operand(instr->name())); | 4021 __ mov(r2, Operand(instr->name())); |
4025 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 4022 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4026 } | 4023 } |
4027 | 4024 |
4028 | 4025 |
4029 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 4026 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
4030 ASSERT(ToRegister(instr->result()).is(r0)); | 4027 ASSERT(ToRegister(instr->result()).is(r0)); |
4031 CallKnownFunction(instr->hydrogen()->target(), | 4028 CallKnownFunction(instr->hydrogen()->target(), |
4032 instr->hydrogen()->formal_parameter_count(), | 4029 instr->hydrogen()->formal_parameter_count(), |
4033 instr->arity(), | 4030 instr->arity(), |
4034 instr, | 4031 instr, |
4035 CALL_AS_FUNCTION, | 4032 CALL_AS_FUNCTION, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4212 } | 4209 } |
4213 | 4210 |
4214 | 4211 |
4215 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4212 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4216 ASSERT(ToRegister(instr->context()).is(cp)); | 4213 ASSERT(ToRegister(instr->context()).is(cp)); |
4217 ASSERT(ToRegister(instr->object()).is(r1)); | 4214 ASSERT(ToRegister(instr->object()).is(r1)); |
4218 ASSERT(ToRegister(instr->value()).is(r0)); | 4215 ASSERT(ToRegister(instr->value()).is(r0)); |
4219 | 4216 |
4220 // Name is always in r2. | 4217 // Name is always in r2. |
4221 __ mov(r2, Operand(instr->name())); | 4218 __ mov(r2, Operand(instr->name())); |
4222 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4219 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
4223 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4220 instr->strict_mode_flag(), |
4224 : isolate()->builtins()->StoreIC_Initialize(); | 4221 NOT_CONTEXTUAL); |
4225 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4222 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4226 } | 4223 } |
4227 | 4224 |
4228 | 4225 |
4229 void LCodeGen::ApplyCheckIf(Condition condition, LBoundsCheck* check) { | 4226 void LCodeGen::ApplyCheckIf(Condition condition, LBoundsCheck* check) { |
4230 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4227 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
4231 Label done; | 4228 Label done; |
4232 __ b(NegateCondition(condition), &done); | 4229 __ b(NegateCondition(condition), &done); |
4233 __ stop("eliminated bounds check failed"); | 4230 __ stop("eliminated bounds check failed"); |
4234 __ bind(&done); | 4231 __ bind(&done); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5824 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5821 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5825 __ ldr(result, FieldMemOperand(scratch, | 5822 __ ldr(result, FieldMemOperand(scratch, |
5826 FixedArray::kHeaderSize - kPointerSize)); | 5823 FixedArray::kHeaderSize - kPointerSize)); |
5827 __ bind(&done); | 5824 __ bind(&done); |
5828 } | 5825 } |
5829 | 5826 |
5830 | 5827 |
5831 #undef __ | 5828 #undef __ |
5832 | 5829 |
5833 } } // namespace v8::internal | 5830 } } // namespace v8::internal |
OLD | NEW |