| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Isolate* isolate, | 354 Isolate* isolate, |
| 355 CodeStubInterfaceDescriptor* descriptor) { | 355 CodeStubInterfaceDescriptor* descriptor) { |
| 356 static Register registers[] = { r1, r0 }; | 356 static Register registers[] = { r1, r0 }; |
| 357 descriptor->register_param_count_ = 2; | 357 descriptor->register_param_count_ = 2; |
| 358 descriptor->register_params_ = registers; | 358 descriptor->register_params_ = registers; |
| 359 descriptor->deoptimization_handler_ = | 359 descriptor->deoptimization_handler_ = |
| 360 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 360 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
| 361 } | 361 } |
| 362 | 362 |
| 363 | 363 |
| 364 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
| 365 static PlatformCallInterfaceDescriptor default_descriptor = |
| 366 PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS); |
| 367 |
| 368 static PlatformCallInterfaceDescriptor noInlineDescriptor = |
| 369 PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS); |
| 370 |
| 371 { |
| 372 CallInterfaceDescriptor* descriptor = |
| 373 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
| 374 static Register registers[] = { r1, // JSFunction |
| 375 cp, // context |
| 376 r0, // actual number of arguments |
| 377 r2, // expected number of arguments |
| 378 }; |
| 379 static Representation representations[] = { |
| 380 Representation::Tagged(), // JSFunction |
| 381 Representation::Tagged(), // context |
| 382 Representation::Integer32(), // actual number of arguments |
| 383 Representation::Integer32(), // expected number of arguments |
| 384 }; |
| 385 descriptor->register_param_count_ = 4; |
| 386 descriptor->register_params_ = registers; |
| 387 descriptor->param_representations_ = representations; |
| 388 descriptor->platform_specific_descriptor_ = &default_descriptor; |
| 389 } |
| 390 { |
| 391 CallInterfaceDescriptor* descriptor = |
| 392 isolate->call_descriptor(Isolate::KeyedCall); |
| 393 static Register registers[] = { cp, // context |
| 394 r2, // key |
| 395 }; |
| 396 static Representation representations[] = { |
| 397 Representation::Tagged(), // context |
| 398 Representation::Tagged(), // key |
| 399 }; |
| 400 descriptor->register_param_count_ = 2; |
| 401 descriptor->register_params_ = registers; |
| 402 descriptor->param_representations_ = representations; |
| 403 descriptor->platform_specific_descriptor_ = &noInlineDescriptor; |
| 404 } |
| 405 { |
| 406 CallInterfaceDescriptor* descriptor = |
| 407 isolate->call_descriptor(Isolate::NamedCall); |
| 408 static Register registers[] = { cp, // context |
| 409 r2, // name |
| 410 }; |
| 411 static Representation representations[] = { |
| 412 Representation::Tagged(), // context |
| 413 Representation::Tagged(), // name |
| 414 }; |
| 415 descriptor->register_param_count_ = 2; |
| 416 descriptor->register_params_ = registers; |
| 417 descriptor->param_representations_ = representations; |
| 418 descriptor->platform_specific_descriptor_ = &noInlineDescriptor; |
| 419 } |
| 420 } |
| 421 |
| 422 |
| 364 #define __ ACCESS_MASM(masm) | 423 #define __ ACCESS_MASM(masm) |
| 365 | 424 |
| 366 | 425 |
| 367 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 426 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
| 368 Label* slow, | 427 Label* slow, |
| 369 Condition cond); | 428 Condition cond); |
| 370 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 429 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
| 371 Register lhs, | 430 Register lhs, |
| 372 Register rhs, | 431 Register rhs, |
| 373 Label* lhs_not_nan, | 432 Label* lhs_not_nan, |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 __ b(ne, &slow); | 3250 __ b(ne, &slow); |
| 3192 | 3251 |
| 3193 if (RecordCallTarget()) { | 3252 if (RecordCallTarget()) { |
| 3194 GenerateRecordCallTarget(masm); | 3253 GenerateRecordCallTarget(masm); |
| 3195 } | 3254 } |
| 3196 | 3255 |
| 3197 // Fast-case: Invoke the function now. | 3256 // Fast-case: Invoke the function now. |
| 3198 // r1: pushed function | 3257 // r1: pushed function |
| 3199 ParameterCount actual(argc_); | 3258 ParameterCount actual(argc_); |
| 3200 | 3259 |
| 3201 __ InvokeFunction(r1, | 3260 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 3202 actual, | |
| 3203 JUMP_FUNCTION, | |
| 3204 NullCallWrapper(), | |
| 3205 CALL_AS_FUNCTION); | |
| 3206 | 3261 |
| 3207 // Slow-case: Non-function called. | 3262 // Slow-case: Non-function called. |
| 3208 __ bind(&slow); | 3263 __ bind(&slow); |
| 3209 if (RecordCallTarget()) { | 3264 if (RecordCallTarget()) { |
| 3210 // If there is a call target cache, mark it megamorphic in the | 3265 // If there is a call target cache, mark it megamorphic in the |
| 3211 // non-function case. MegamorphicSentinel is an immortal immovable | 3266 // non-function case. MegamorphicSentinel is an immortal immovable |
| 3212 // object (undefined) so no write barrier is needed. | 3267 // object (undefined) so no write barrier is needed. |
| 3213 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3268 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 3214 masm->isolate()->heap()->undefined_value()); | 3269 masm->isolate()->heap()->undefined_value()); |
| 3215 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3270 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 3216 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); | 3271 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
| 3217 } | 3272 } |
| 3218 // Check for function proxy. | 3273 // Check for function proxy. |
| 3219 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3274 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3220 __ b(ne, &non_function); | 3275 __ b(ne, &non_function); |
| 3221 __ push(r1); // put proxy as additional argument | 3276 __ push(r1); // put proxy as additional argument |
| 3222 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); | 3277 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); |
| 3223 __ mov(r2, Operand::Zero()); | 3278 __ mov(r2, Operand::Zero()); |
| 3224 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 3279 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); |
| 3225 __ SetCallKind(r5, CALL_AS_FUNCTION); | |
| 3226 { | 3280 { |
| 3227 Handle<Code> adaptor = | 3281 Handle<Code> adaptor = |
| 3228 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 3282 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 3229 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 3283 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
| 3230 } | 3284 } |
| 3231 | 3285 |
| 3232 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 3286 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 3233 // of the original receiver from the call site). | 3287 // of the original receiver from the call site). |
| 3234 __ bind(&non_function); | 3288 __ bind(&non_function); |
| 3235 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); | 3289 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); |
| 3236 __ mov(r0, Operand(argc_)); // Set up the number of arguments. | 3290 __ mov(r0, Operand(argc_)); // Set up the number of arguments. |
| 3237 __ mov(r2, Operand::Zero()); | 3291 __ mov(r2, Operand::Zero()); |
| 3238 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 3292 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); |
| 3239 __ SetCallKind(r5, CALL_AS_FUNCTION); | |
| 3240 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3293 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3241 RelocInfo::CODE_TARGET); | 3294 RelocInfo::CODE_TARGET); |
| 3242 } | 3295 } |
| 3243 | 3296 |
| 3244 | 3297 |
| 3245 void CallConstructStub::Generate(MacroAssembler* masm) { | 3298 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 3246 // r0 : number of arguments | 3299 // r0 : number of arguments |
| 3247 // r1 : the function to call | 3300 // r1 : the function to call |
| 3248 // r2 : cache cell for call target | 3301 // r2 : cache cell for call target |
| 3249 Label slow, non_function_call; | 3302 Label slow, non_function_call; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3265 SharedFunctionInfo::kConstructStubOffset)); | 3318 SharedFunctionInfo::kConstructStubOffset)); |
| 3266 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3319 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 3267 | 3320 |
| 3268 // r0: number of arguments | 3321 // r0: number of arguments |
| 3269 // r1: called object | 3322 // r1: called object |
| 3270 // r3: object type | 3323 // r3: object type |
| 3271 Label do_call; | 3324 Label do_call; |
| 3272 __ bind(&slow); | 3325 __ bind(&slow); |
| 3273 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3326 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3274 __ b(ne, &non_function_call); | 3327 __ b(ne, &non_function_call); |
| 3275 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 3328 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
| 3276 __ jmp(&do_call); | 3329 __ jmp(&do_call); |
| 3277 | 3330 |
| 3278 __ bind(&non_function_call); | 3331 __ bind(&non_function_call); |
| 3279 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 3332 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 3280 __ bind(&do_call); | 3333 __ bind(&do_call); |
| 3281 // Set expected number of arguments to zero (not changing r0). | 3334 // Set expected number of arguments to zero (not changing r0). |
| 3282 __ mov(r2, Operand::Zero()); | 3335 __ mov(r2, Operand::Zero()); |
| 3283 __ SetCallKind(r5, CALL_AS_METHOD); | |
| 3284 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3336 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3285 RelocInfo::CODE_TARGET); | 3337 RelocInfo::CODE_TARGET); |
| 3286 } | 3338 } |
| 3287 | 3339 |
| 3288 | 3340 |
| 3289 // StringCharCodeAtGenerator | 3341 // StringCharCodeAtGenerator |
| 3290 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3342 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 3291 Label flat_string; | 3343 Label flat_string; |
| 3292 Label ascii_string; | 3344 Label ascii_string; |
| 3293 Label got_char_code; | 3345 Label got_char_code; |
| (...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 __ mov(r1, r0); | 5469 __ mov(r1, r0); |
| 5418 int parameter_count_offset = | 5470 int parameter_count_offset = |
| 5419 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5471 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5420 __ ldr(r0, MemOperand(fp, parameter_count_offset)); | 5472 __ ldr(r0, MemOperand(fp, parameter_count_offset)); |
| 5421 // The parameter count above includes the receiver for the arguments passed to | 5473 // The parameter count above includes the receiver for the arguments passed to |
| 5422 // the deoptimization handler. Subtract the receiver for the parameter count | 5474 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5423 // for the call. | 5475 // for the call. |
| 5424 __ sub(r0, r0, Operand(1)); | 5476 __ sub(r0, r0, Operand(1)); |
| 5425 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5477 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5426 ParameterCount argument_count(r0); | 5478 ParameterCount argument_count(r0); |
| 5427 __ InvokeFunction( | 5479 __ InvokeFunction(r1, argument_count, JUMP_FUNCTION, NullCallWrapper()); |
| 5428 r1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
| 5429 } | 5480 } |
| 5430 | 5481 |
| 5431 | 5482 |
| 5432 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5483 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5433 if (masm->isolate()->function_entry_hook() != NULL) { | 5484 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5434 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); | 5485 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); |
| 5435 ProfileEntryHookStub stub; | 5486 ProfileEntryHookStub stub; |
| 5436 __ push(lr); | 5487 __ push(lr); |
| 5437 __ CallStub(&stub); | 5488 __ CallStub(&stub); |
| 5438 __ pop(lr); | 5489 __ pop(lr); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5800 __ bind(&fast_elements_case); | 5851 __ bind(&fast_elements_case); |
| 5801 GenerateCase(masm, FAST_ELEMENTS); | 5852 GenerateCase(masm, FAST_ELEMENTS); |
| 5802 } | 5853 } |
| 5803 | 5854 |
| 5804 | 5855 |
| 5805 #undef __ | 5856 #undef __ |
| 5806 | 5857 |
| 5807 } } // namespace v8::internal | 5858 } } // namespace v8::internal |
| 5808 | 5859 |
| 5809 #endif // V8_TARGET_ARCH_ARM | 5860 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |