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

Side by Side Diff: src/builtins/ia32/builtins-ia32.cc

Issue 2803853005: Inline Array.prototype.forEach in TurboFan (Closed)
Patch Set: Disable new array builtins by default Created 3 years, 6 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
« no previous file with comments | « src/builtins/builtins-definitions.h ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1455 }
1456 1456
1457 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { 1457 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
1458 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); 1458 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
1459 } 1459 }
1460 1460
1461 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { 1461 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
1462 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); 1462 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
1463 } 1463 }
1464 1464
1465 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) {
1466 // Enter an internal frame.
1467 {
1468 FrameScope scope(masm, StackFrame::INTERNAL);
1469 // Preserve possible return result from lazy deopt.
1470 __ push(eax);
1471 __ CallRuntime(Runtime::kNotifyStubFailure, false);
1472 __ pop(eax);
1473 // Tear down internal frame.
1474 }
1475
1476 __ pop(MemOperand(esp, 0)); // Ignore state offset
1477 __ ret(0); // Return to ContinueToBuiltin stub still on stack.
1478 }
1479
1480 namespace {
1481 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
1482 bool java_script_builtin,
1483 bool with_result) {
1484 const RegisterConfiguration* config(RegisterConfiguration::Turbofan());
1485 int allocatable_register_count = config->num_allocatable_general_registers();
1486 if (with_result) {
1487 // Overwrite the hole inserted by the deoptimizer with the return value from
1488 // the LAZY deopt point.
1489 __ mov(Operand(esp,
1490 config->num_allocatable_general_registers() * kPointerSize +
1491 BuiltinContinuationFrameConstants::kFixedFrameSize),
1492 eax);
1493 }
1494 for (int i = allocatable_register_count - 1; i >= 0; --i) {
1495 int code = config->GetAllocatableGeneralCode(i);
1496 __ pop(Register::from_code(code));
1497 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) {
1498 __ SmiUntag(Register::from_code(code));
1499 }
1500 }
1501 __ mov(
1502 ebp,
1503 Operand(esp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
1504 const int offsetToPC =
1505 BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp - kPointerSize;
1506 __ pop(Operand(esp, offsetToPC));
1507 __ Drop(offsetToPC / kPointerSize);
1508 __ add(Operand(esp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag));
1509 __ ret(0);
1510 }
1511 } // namespace
1512
1513 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) {
1514 Generate_ContinueToBuiltinHelper(masm, false, false);
1515 }
1516
1517 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult(
1518 MacroAssembler* masm) {
1519 Generate_ContinueToBuiltinHelper(masm, false, true);
1520 }
1521
1522 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) {
1523 Generate_ContinueToBuiltinHelper(masm, true, false);
1524 }
1525
1526 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult(
1527 MacroAssembler* masm) {
1528 Generate_ContinueToBuiltinHelper(masm, true, true);
1529 }
1530
1465 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, 1531 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
1466 Deoptimizer::BailoutType type) { 1532 Deoptimizer::BailoutType type) {
1467 { 1533 {
1468 FrameScope scope(masm, StackFrame::INTERNAL); 1534 FrameScope scope(masm, StackFrame::INTERNAL);
1469 1535
1470 // Pass deoptimization type to the runtime system. 1536 // Pass deoptimization type to the runtime system.
1471 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); 1537 __ push(Immediate(Smi::FromInt(static_cast<int>(type))));
1472 __ CallRuntime(Runtime::kNotifyDeoptimized); 1538 __ CallRuntime(Runtime::kNotifyDeoptimized);
1473 1539
1474 // Tear down internal frame. 1540 // Tear down internal frame.
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 } 3391 }
3326 // Now jump to the instructions of the returned code object. 3392 // Now jump to the instructions of the returned code object.
3327 __ jmp(edi); 3393 __ jmp(edi);
3328 } 3394 }
3329 3395
3330 #undef __ 3396 #undef __
3331 } // namespace internal 3397 } // namespace internal
3332 } // namespace v8 3398 } // namespace v8
3333 3399
3334 #endif // V8_TARGET_ARCH_IA32 3400 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/builtins-definitions.h ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698