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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 3357023: [Isolates] Pass current isolate address to the regexp native functions (Closed)
Patch Set: Made helper function private(ARM) Created 10 years, 3 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/arm/simulator-arm.h ('k') | src/ia32/regexp-macro-assembler-ia32.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 1597 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1598 and_(scratch1, kFlatAsciiStringMask); 1598 and_(scratch1, kFlatAsciiStringMask);
1599 and_(scratch2, kFlatAsciiStringMask); 1599 and_(scratch2, kFlatAsciiStringMask);
1600 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 1600 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1601 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); 1601 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3));
1602 j(not_equal, failure); 1602 j(not_equal, failure);
1603 } 1603 }
1604 1604
1605 1605
1606 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 1606 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
1607 // Reserve space for Isolate address which is always passed as last parameter
1608 num_arguments += 1;
1609
1607 int frameAlignment = OS::ActivationFrameAlignment(); 1610 int frameAlignment = OS::ActivationFrameAlignment();
1608 if (frameAlignment != 0) { 1611 if (frameAlignment != 0) {
1609 // Make stack end at alignment and make room for num_arguments words 1612 // Make stack end at alignment and make room for num_arguments words
1610 // and the original value of esp. 1613 // and the original value of esp.
1611 mov(scratch, esp); 1614 mov(scratch, esp);
1612 sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize)); 1615 sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize));
1613 ASSERT(IsPowerOf2(frameAlignment)); 1616 ASSERT(IsPowerOf2(frameAlignment));
1614 and_(esp, -frameAlignment); 1617 and_(esp, -frameAlignment);
1615 mov(Operand(esp, num_arguments * kPointerSize), scratch); 1618 mov(Operand(esp, num_arguments * kPointerSize), scratch);
1616 } else { 1619 } else {
1617 sub(Operand(esp), Immediate(num_arguments * kPointerSize)); 1620 sub(Operand(esp), Immediate(num_arguments * kPointerSize));
1618 } 1621 }
1619 } 1622 }
1620 1623
1621 1624
1622 void MacroAssembler::CallCFunction(ExternalReference function, 1625 void MacroAssembler::CallCFunction(ExternalReference function,
1623 int num_arguments) { 1626 int num_arguments) {
1624 // Trashing eax is ok as it will be the return value. 1627 // Trashing eax is ok as it will be the return value.
1625 mov(Operand(eax), Immediate(function)); 1628 mov(Operand(eax), Immediate(function));
1626 CallCFunction(eax, num_arguments); 1629 CallCFunction(eax, num_arguments);
1627 } 1630 }
1628 1631
1629 1632
1630 void MacroAssembler::CallCFunction(Register function, 1633 void MacroAssembler::CallCFunction(Register function,
1631 int num_arguments) { 1634 int num_arguments) {
1635 // Pass current isolate address as additional parameter.
1636 mov(Operand(esp, num_arguments * kPointerSize),
1637 Immediate(ExternalReference::isolate_address()));
1638 num_arguments += 1;
1639
1632 // Check stack alignment. 1640 // Check stack alignment.
1633 if (FLAG_debug_code) { 1641 if (FLAG_debug_code) {
1634 CheckStackAlignment(); 1642 CheckStackAlignment();
1635 } 1643 }
1636 1644
1637 call(Operand(function)); 1645 call(Operand(function));
1638 if (OS::ActivationFrameAlignment() != 0) { 1646 if (OS::ActivationFrameAlignment() != 0) {
1639 mov(esp, Operand(esp, num_arguments * kPointerSize)); 1647 mov(esp, Operand(esp, num_arguments * kPointerSize));
1640 } else { 1648 } else {
1641 add(Operand(esp), Immediate(num_arguments * sizeof(int32_t))); 1649 add(Operand(esp), Immediate(num_arguments * sizeof(int32_t)));
(...skipping 16 matching lines...) Expand all
1658 1666
1659 // Check that the code was patched as expected. 1667 // Check that the code was patched as expected.
1660 ASSERT(masm_.pc_ == address_ + size_); 1668 ASSERT(masm_.pc_ == address_ + size_);
1661 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1669 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1662 } 1670 }
1663 1671
1664 1672
1665 } } // namespace v8::internal 1673 } } // namespace v8::internal
1666 1674
1667 #endif // V8_TARGET_ARCH_IA32 1675 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.h ('k') | src/ia32/regexp-macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698