Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6479019: Port bug fixes to optimized Function.prototype.apply to ARM. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 __ SmiUntag(result); 2481 __ SmiUntag(result);
2482 2482
2483 // Argument length is in result register. 2483 // Argument length is in result register.
2484 __ bind(&done); 2484 __ bind(&done);
2485 } 2485 }
2486 2486
2487 2487
2488 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 2488 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
2489 Register receiver = ToRegister(instr->receiver()); 2489 Register receiver = ToRegister(instr->receiver());
2490 Register function = ToRegister(instr->function()); 2490 Register function = ToRegister(instr->function());
2491 Register length = ToRegister(instr->length());
2492 Register elements = ToRegister(instr->elements());
2491 Register scratch = scratch0(); 2493 Register scratch = scratch0();
2492 2494 ASSERT(receiver.is(r0)); // Used for parameter count.
2493 ASSERT(receiver.is(r0)); 2495 ASSERT(function.is(r1)); // Required by InvokeFunction.
2494 ASSERT(function.is(r1));
2495 ASSERT(ToRegister(instr->result()).is(r0)); 2496 ASSERT(ToRegister(instr->result()).is(r0));
2496 2497
2497 // If the receiver is null or undefined, we have to pass the 2498 // If the receiver is null or undefined, we have to pass the global object
2498 // global object as a receiver. 2499 // as a receiver.
2499 Label global_receiver, receiver_ok; 2500 Label global_object, receiver_ok;
2500 __ LoadRoot(scratch, Heap::kNullValueRootIndex); 2501 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2501 __ cmp(receiver, scratch); 2502 __ cmp(receiver, scratch);
2502 __ b(eq, &global_receiver); 2503 __ b(eq, &global_object);
2503 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2504 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2504 __ cmp(receiver, scratch); 2505 __ cmp(receiver, scratch);
2505 __ b(ne, &receiver_ok); 2506 __ b(eq, &global_object);
2506 __ bind(&global_receiver); 2507
2508 // Deoptimize if the receiver is not a JS object.
2509 __ tst(receiver, Operand(kSmiTagMask));
2510 DeoptimizeIf(eq, instr->environment());
2511 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_OBJECT_TYPE);
2512 DeoptimizeIf(lo, instr->environment());
2513 __ jmp(&receiver_ok);
2514
2515 __ bind(&global_object);
2507 __ ldr(receiver, GlobalObjectOperand()); 2516 __ ldr(receiver, GlobalObjectOperand());
2508 __ bind(&receiver_ok); 2517 __ bind(&receiver_ok);
2509 2518
2510 Register length = ToRegister(instr->length());
2511 Register elements = ToRegister(instr->elements());
2512
2513 Label invoke;
2514
2515 // Copy the arguments to this function possibly from the 2519 // Copy the arguments to this function possibly from the
2516 // adaptor frame below it. 2520 // adaptor frame below it.
2517 const uint32_t kArgumentsLimit = 1 * KB; 2521 const uint32_t kArgumentsLimit = 1 * KB;
2518 __ cmp(length, Operand(kArgumentsLimit)); 2522 __ cmp(length, Operand(kArgumentsLimit));
2519 DeoptimizeIf(hi, instr->environment()); 2523 DeoptimizeIf(hi, instr->environment());
2520 2524
2521 // Push the receiver and use the register to keep the original 2525 // Push the receiver and use the register to keep the original
2522 // number of arguments. 2526 // number of arguments.
2523 __ push(receiver); 2527 __ push(receiver);
2524 __ mov(receiver, length); 2528 __ mov(receiver, length);
2525 // The arguments are at a one pointer size offset from elements. 2529 // The arguments are at a one pointer size offset from elements.
2526 __ add(elements, elements, Operand(1 * kPointerSize)); 2530 __ add(elements, elements, Operand(1 * kPointerSize));
2527 2531
2528 // Loop through the arguments pushing them onto the execution 2532 // Loop through the arguments pushing them onto the execution
2529 // stack. 2533 // stack.
2530 Label loop; 2534 Label invoke, loop;
2531 // length is a small non-negative integer, due to the test above. 2535 // length is a small non-negative integer, due to the test above.
2532 __ tst(length, Operand(length)); 2536 __ tst(length, Operand(length));
2533 __ b(eq, &invoke); 2537 __ b(eq, &invoke);
2534 __ bind(&loop); 2538 __ bind(&loop);
2535 __ ldr(scratch, MemOperand(elements, length, LSL, 2)); 2539 __ ldr(scratch, MemOperand(elements, length, LSL, 2));
2536 __ push(scratch); 2540 __ push(scratch);
2537 __ sub(length, length, Operand(1), SetCC); 2541 __ sub(length, length, Operand(1), SetCC);
2538 __ b(ne, &loop); 2542 __ b(ne, &loop);
2539 2543
2540 __ bind(&invoke); 2544 __ bind(&invoke);
2541 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); 2545 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2542 LPointerMap* pointers = instr->pointer_map(); 2546 LPointerMap* pointers = instr->pointer_map();
2543 LEnvironment* env = instr->deoptimization_environment(); 2547 LEnvironment* env = instr->deoptimization_environment();
2544 RecordPosition(pointers->position()); 2548 RecordPosition(pointers->position());
2545 RegisterEnvironmentForDeoptimization(env); 2549 RegisterEnvironmentForDeoptimization(env);
2546 SafepointGenerator safepoint_generator(this, 2550 SafepointGenerator safepoint_generator(this,
2547 pointers, 2551 pointers,
2548 env->deoptimization_index()); 2552 env->deoptimization_index());
2549 // The number of arguments is stored in receiver which is r0, as expected 2553 // The number of arguments is stored in receiver which is r0, as expected
2550 // by InvokeFunction. 2554 // by InvokeFunction.
2551 v8::internal::ParameterCount actual(receiver); 2555 v8::internal::ParameterCount actual(receiver);
2552 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); 2556 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
2557 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2553 } 2558 }
2554 2559
2555 2560
2556 void LCodeGen::DoPushArgument(LPushArgument* instr) { 2561 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2557 LOperand* argument = instr->InputAt(0); 2562 LOperand* argument = instr->InputAt(0);
2558 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { 2563 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
2559 Abort("DoPushArgument not implemented for double type."); 2564 Abort("DoPushArgument not implemented for double type.");
2560 } else { 2565 } else {
2561 Register argument_reg = EmitLoadRegister(argument, ip); 2566 Register argument_reg = EmitLoadRegister(argument, ip);
2562 __ push(argument_reg); 2567 __ push(argument_reg);
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 3912
3908 3913
3909 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 3914 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
3910 Abort("DoOsrEntry unimplemented."); 3915 Abort("DoOsrEntry unimplemented.");
3911 } 3916 }
3912 3917
3913 3918
3914 #undef __ 3919 #undef __
3915 3920
3916 } } // namespace v8::internal 3921 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698