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 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3191 __ b(ne, &slow); | 3191 __ b(ne, &slow); |
3192 | 3192 |
3193 if (RecordCallTarget()) { | 3193 if (RecordCallTarget()) { |
3194 GenerateRecordCallTarget(masm); | 3194 GenerateRecordCallTarget(masm); |
3195 } | 3195 } |
3196 | 3196 |
3197 // Fast-case: Invoke the function now. | 3197 // Fast-case: Invoke the function now. |
3198 // r1: pushed function | 3198 // r1: pushed function |
3199 ParameterCount actual(argc_); | 3199 ParameterCount actual(argc_); |
3200 | 3200 |
3201 __ InvokeFunction(r1, | 3201 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); |
3202 actual, | |
3203 JUMP_FUNCTION, | |
3204 NullCallWrapper(), | |
3205 CALL_AS_FUNCTION); | |
3206 | 3202 |
3207 // Slow-case: Non-function called. | 3203 // Slow-case: Non-function called. |
3208 __ bind(&slow); | 3204 __ bind(&slow); |
3209 if (RecordCallTarget()) { | 3205 if (RecordCallTarget()) { |
3210 // If there is a call target cache, mark it megamorphic in the | 3206 // If there is a call target cache, mark it megamorphic in the |
3211 // non-function case. MegamorphicSentinel is an immortal immovable | 3207 // non-function case. MegamorphicSentinel is an immortal immovable |
3212 // object (undefined) so no write barrier is needed. | 3208 // object (undefined) so no write barrier is needed. |
3213 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3209 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
3214 masm->isolate()->heap()->undefined_value()); | 3210 masm->isolate()->heap()->undefined_value()); |
3215 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3211 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
3216 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); | 3212 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
3217 } | 3213 } |
3218 // Check for function proxy. | 3214 // Check for function proxy. |
3219 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3215 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
3220 __ b(ne, &non_function); | 3216 __ b(ne, &non_function); |
3221 __ push(r1); // put proxy as additional argument | 3217 __ push(r1); // put proxy as additional argument |
3222 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); | 3218 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); |
3223 __ mov(r2, Operand::Zero()); | 3219 __ mov(r2, Operand::Zero()); |
3224 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 3220 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
3225 __ SetCallKind(r5, CALL_AS_FUNCTION); | |
3226 { | 3221 { |
3227 Handle<Code> adaptor = | 3222 Handle<Code> adaptor = |
3228 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 3223 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
3229 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 3224 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
3230 } | 3225 } |
3231 | 3226 |
3232 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 3227 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
3233 // of the original receiver from the call site). | 3228 // of the original receiver from the call site). |
3234 __ bind(&non_function); | 3229 __ bind(&non_function); |
3235 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); | 3230 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); |
3236 __ mov(r0, Operand(argc_)); // Set up the number of arguments. | 3231 __ mov(r0, Operand(argc_)); // Set up the number of arguments. |
3237 __ mov(r2, Operand::Zero()); | 3232 __ mov(r2, Operand::Zero()); |
3238 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 3233 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
3239 __ SetCallKind(r5, CALL_AS_FUNCTION); | |
3240 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3234 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
3241 RelocInfo::CODE_TARGET); | 3235 RelocInfo::CODE_TARGET); |
3242 } | 3236 } |
3243 | 3237 |
3244 | 3238 |
3245 void CallConstructStub::Generate(MacroAssembler* masm) { | 3239 void CallConstructStub::Generate(MacroAssembler* masm) { |
3246 // r0 : number of arguments | 3240 // r0 : number of arguments |
3247 // r1 : the function to call | 3241 // r1 : the function to call |
3248 // r2 : cache cell for call target | 3242 // r2 : cache cell for call target |
3249 Label slow, non_function_call; | 3243 Label slow, non_function_call; |
(...skipping 23 matching lines...) Expand all Loading... |
3273 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3267 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
3274 __ b(ne, &non_function_call); | 3268 __ b(ne, &non_function_call); |
3275 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 3269 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
3276 __ jmp(&do_call); | 3270 __ jmp(&do_call); |
3277 | 3271 |
3278 __ bind(&non_function_call); | 3272 __ bind(&non_function_call); |
3279 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 3273 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
3280 __ bind(&do_call); | 3274 __ bind(&do_call); |
3281 // Set expected number of arguments to zero (not changing r0). | 3275 // Set expected number of arguments to zero (not changing r0). |
3282 __ mov(r2, Operand::Zero()); | 3276 __ mov(r2, Operand::Zero()); |
3283 __ SetCallKind(r5, CALL_AS_METHOD); | |
3284 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3277 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
3285 RelocInfo::CODE_TARGET); | 3278 RelocInfo::CODE_TARGET); |
3286 } | 3279 } |
3287 | 3280 |
3288 | 3281 |
3289 // StringCharCodeAtGenerator | 3282 // StringCharCodeAtGenerator |
3290 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3283 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
3291 Label flat_string; | 3284 Label flat_string; |
3292 Label ascii_string; | 3285 Label ascii_string; |
3293 Label got_char_code; | 3286 Label got_char_code; |
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5417 __ mov(r1, r0); | 5410 __ mov(r1, r0); |
5418 int parameter_count_offset = | 5411 int parameter_count_offset = |
5419 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5412 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
5420 __ ldr(r0, MemOperand(fp, parameter_count_offset)); | 5413 __ ldr(r0, MemOperand(fp, parameter_count_offset)); |
5421 // The parameter count above includes the receiver for the arguments passed to | 5414 // The parameter count above includes the receiver for the arguments passed to |
5422 // the deoptimization handler. Subtract the receiver for the parameter count | 5415 // the deoptimization handler. Subtract the receiver for the parameter count |
5423 // for the call. | 5416 // for the call. |
5424 __ sub(r0, r0, Operand(1)); | 5417 __ sub(r0, r0, Operand(1)); |
5425 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5418 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
5426 ParameterCount argument_count(r0); | 5419 ParameterCount argument_count(r0); |
5427 __ InvokeFunction( | 5420 __ InvokeFunction(r1, argument_count, JUMP_FUNCTION, NullCallWrapper()); |
5428 r1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
5429 } | 5421 } |
5430 | 5422 |
5431 | 5423 |
5432 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5424 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
5433 if (masm->isolate()->function_entry_hook() != NULL) { | 5425 if (masm->isolate()->function_entry_hook() != NULL) { |
5434 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); | 5426 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); |
5435 ProfileEntryHookStub stub; | 5427 ProfileEntryHookStub stub; |
5436 __ push(lr); | 5428 __ push(lr); |
5437 __ CallStub(&stub); | 5429 __ CallStub(&stub); |
5438 __ pop(lr); | 5430 __ pop(lr); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5800 __ bind(&fast_elements_case); | 5792 __ bind(&fast_elements_case); |
5801 GenerateCase(masm, FAST_ELEMENTS); | 5793 GenerateCase(masm, FAST_ELEMENTS); |
5802 } | 5794 } |
5803 | 5795 |
5804 | 5796 |
5805 #undef __ | 5797 #undef __ |
5806 | 5798 |
5807 } } // namespace v8::internal | 5799 } } // namespace v8::internal |
5808 | 5800 |
5809 #endif // V8_TARGET_ARCH_ARM | 5801 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |