Fix non-ia32 build.

Review URL: http://codereview.chromium.org/6771052

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7484 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vitalyr@chromium.org 2011-04-01 15:37:59 +00:00
parent 66446147f4
commit 6952f68ee3
7 changed files with 136 additions and 69 deletions

View File

@ -39,11 +39,14 @@
namespace v8 {
namespace internal {
MacroAssembler::MacroAssembler(void* buffer, int size)
: Assembler(Isolate::Current(), buffer, size),
MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
: Assembler(arg_isolate, buffer, size),
generating_stub_(false),
allow_stub_calls_(true),
code_object_(isolate()->heap()->undefined_value()) {
allow_stub_calls_(true) {
if (isolate() != NULL) {
code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
isolate());
}
}
@ -2896,7 +2899,7 @@ CodePatcher::CodePatcher(byte* address, int instructions)
: address_(address),
instructions_(instructions),
size_(instructions * Assembler::kInstrSize),
masm_(address, size_ + Assembler::kGap) {
masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
// Create a new macro assembler pointing to the address of the code to patch.
// The size is adjusted with kGap on order for the assembler to generate size
// bytes of instructions without failing with buffer size constraints.

View File

@ -90,7 +90,11 @@ enum ObjectToDoubleFlags {
// MacroAssembler implements a collection of frequently used macros.
class MacroAssembler: public Assembler {
public:
MacroAssembler(void* buffer, int size);
// The isolate parameter can be NULL if the macro assembler should
// not use isolate-dependent functionality. In this case, it's the
// responsibility of the caller to never invoke such function on the
// macro assembler.
MacroAssembler(Isolate* isolate, void* buffer, int size);
// Jump, Call, and Ret pseudo instructions implementing inter-working.
void Jump(Register target, Condition cond = al);
@ -781,7 +785,10 @@ class MacroAssembler: public Assembler {
// Store the function for the given builtin in the target register.
void GetBuiltinFunction(Register target, Builtins::JavaScript id);
Handle<Object> CodeObject() { return code_object_; }
Handle<Object> CodeObject() {
ASSERT(!code_object_.is_null());
return code_object_;
}
// ---------------------------------------------------------------------------

View File

@ -116,7 +116,7 @@ namespace internal {
RegExpMacroAssemblerARM::RegExpMacroAssemblerARM(
Mode mode,
int registers_to_save)
: masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
: masm_(new MacroAssembler(Isolate::Current(), NULL, kRegExpCodeSize)),
mode_(mode),
num_registers_(registers_to_save),
num_saved_registers_(registers_to_save),

View File

@ -40,12 +40,15 @@
namespace v8 {
namespace internal {
MacroAssembler::MacroAssembler(void* buffer, int size)
: Assembler(Isolate::Current(), buffer, size),
MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
: Assembler(arg_isolate, buffer, size),
generating_stub_(false),
allow_stub_calls_(true),
root_array_available_(true),
code_object_(isolate()->heap()->undefined_value()) {
root_array_available_(true) {
if (isolate() != NULL) {
code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
isolate());
}
}
@ -2885,7 +2888,9 @@ void MacroAssembler::CallCFunction(Register function, int num_arguments) {
CodePatcher::CodePatcher(byte* address, int size)
: address_(address), size_(size), masm_(address, size + Assembler::kGap) {
: address_(address),
size_(size),
masm_(Isolate::Current(), address, size + Assembler::kGap) {
// Create a new macro assembler pointing to the address of the code to patch.
// The size is adjusted with kGap on order for the assembler to generate size
// bytes of instructions without failing with buffer size constraints.

View File

@ -74,7 +74,11 @@ struct SmiIndex {
// MacroAssembler implements a collection of frequently used macros.
class MacroAssembler: public Assembler {
public:
MacroAssembler(void* buffer, int size);
// The isolate parameter can be NULL if the macro assembler should
// not use isolate-dependent functionality. In this case, it's the
// responsibility of the caller to never invoke such function on the
// macro assembler.
MacroAssembler(Isolate* isolate, void* buffer, int size);
// Prevent the use of the RootArray during the lifetime of this
// scope object.
@ -1029,7 +1033,10 @@ class MacroAssembler: public Assembler {
// may be bigger than 2^16 - 1. Requires a scratch register.
void Ret(int bytes_dropped, Register scratch);
Handle<Object> CodeObject() { return code_object_; }
Handle<Object> CodeObject() {
ASSERT(!code_object_.is_null());
return code_object_;
}
// Copy length bytes from source to destination.
// Uses scratch register internally (if you have a low-eight register

View File

@ -114,7 +114,7 @@ namespace internal {
RegExpMacroAssemblerX64::RegExpMacroAssemblerX64(
Mode mode,
int registers_to_save)
: masm_(NULL, kRegExpCodeSize),
: masm_(Isolate::Current(), NULL, kRegExpCodeSize),
no_root_array_scope_(&masm_),
code_relative_fixup_positions_(4),
mode_(mode),

View File

@ -35,48 +35,49 @@
#include "serialize.h"
#include "cctest.h"
using v8::internal::byte;
using v8::internal::OS;
using v8::internal::Assembler;
using v8::internal::CodeDesc;
using v8::internal::Condition;
using v8::internal::MacroAssembler;
using v8::internal::FUNCTION_CAST;
using v8::internal::HandleScope;
using v8::internal::Operand;
using v8::internal::Immediate;
using v8::internal::SmiIndex;
using v8::internal::Isolate;
using v8::internal::Label;
using v8::internal::MacroAssembler;
using v8::internal::OS;
using v8::internal::Operand;
using v8::internal::RelocInfo;
using v8::internal::rax;
using v8::internal::rbx;
using v8::internal::rsi;
using v8::internal::rdi;
using v8::internal::rcx;
using v8::internal::rdx;
using v8::internal::rbp;
using v8::internal::rsp;
using v8::internal::r8;
using v8::internal::r9;
using v8::internal::Smi;
using v8::internal::SmiIndex;
using v8::internal::byte;
using v8::internal::carry;
using v8::internal::greater;
using v8::internal::greater_equal;
using v8::internal::kIntSize;
using v8::internal::kPointerSize;
using v8::internal::kSmiTagMask;
using v8::internal::kSmiValueSize;
using v8::internal::less_equal;
using v8::internal::negative;
using v8::internal::not_carry;
using v8::internal::not_equal;
using v8::internal::not_zero;
using v8::internal::positive;
using v8::internal::r11;
using v8::internal::r13;
using v8::internal::r14;
using v8::internal::r15;
using v8::internal::r8;
using v8::internal::r9;
using v8::internal::rax;
using v8::internal::rbp;
using v8::internal::rbx;
using v8::internal::rcx;
using v8::internal::rdi;
using v8::internal::rdx;
using v8::internal::rsi;
using v8::internal::rsp;
using v8::internal::times_pointer_size;
using v8::internal::FUNCTION_CAST;
using v8::internal::CodeDesc;
using v8::internal::less_equal;
using v8::internal::not_equal;
using v8::internal::not_zero;
using v8::internal::greater;
using v8::internal::greater_equal;
using v8::internal::carry;
using v8::internal::not_carry;
using v8::internal::negative;
using v8::internal::positive;
using v8::internal::Smi;
using v8::internal::kSmiTagMask;
using v8::internal::kSmiValueSize;
using v8::internal::kPointerSize;
using v8::internal::kIntSize;
// Test the x64 assembler by compiling some simple functions into
// a buffer and executing them. These tests do not initialize the
@ -157,7 +158,9 @@ TEST(SmiMove) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
masm->set_allow_stub_calls(false);
EntryCode(masm);
@ -245,7 +248,9 @@ TEST(SmiCompare) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -295,7 +300,9 @@ TEST(Integer32ToSmi) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -423,7 +430,9 @@ TEST(Integer64PlusConstantToSmi) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -467,7 +476,9 @@ TEST(SmiCheck) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -715,7 +726,9 @@ TEST(SmiNeg) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -803,7 +816,9 @@ TEST(SmiAdd) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -993,7 +1008,9 @@ TEST(SmiSub) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1083,7 +1100,9 @@ TEST(SmiMul) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1189,7 +1208,9 @@ TEST(SmiDiv) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1299,7 +1320,9 @@ TEST(SmiMod) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1395,7 +1418,9 @@ TEST(SmiIndex) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1464,7 +1489,9 @@ TEST(SmiSelectNonSmi) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false); // Avoid inline checks.
@ -1543,7 +1570,9 @@ TEST(SmiAnd) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1624,7 +1653,9 @@ TEST(SmiOr) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1707,7 +1738,9 @@ TEST(SmiXor) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1774,7 +1807,9 @@ TEST(SmiNot) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1870,7 +1905,9 @@ TEST(SmiShiftLeft) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -1976,7 +2013,9 @@ TEST(SmiShiftLogicalRight) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -2045,7 +2084,9 @@ TEST(SmiShiftArithmeticRight) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -2109,7 +2150,9 @@ TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
@ -2152,7 +2195,9 @@ TEST(OperandOffset) {
true));
CHECK(buffer);
HandleScope handles;
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler assembler(Isolate::Current(),
buffer,
static_cast<int>(actual_size));
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);