summaryrefslogtreecommitdiff
path: root/deps/v8/src/x87/macro-assembler-x87.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/x87/macro-assembler-x87.cc')
-rw-r--r--deps/v8/src/x87/macro-assembler-x87.cc57
1 files changed, 41 insertions, 16 deletions
diff --git a/deps/v8/src/x87/macro-assembler-x87.cc b/deps/v8/src/x87/macro-assembler-x87.cc
index c34a47a251..f5ecf5f677 100644
--- a/deps/v8/src/x87/macro-assembler-x87.cc
+++ b/deps/v8/src/x87/macro-assembler-x87.cc
@@ -25,8 +25,8 @@ MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
has_frame_(false) {
if (isolate() != NULL) {
// TODO(titzer): should we just use a null handle here instead?
- code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
- isolate());
+ code_object_ =
+ Handle<Object>::New(isolate()->heap()->undefined_value(), isolate());
}
}
@@ -943,22 +943,27 @@ void MacroAssembler::EnterApiExitFrame(int argc) {
}
-void MacroAssembler::LeaveExitFrame(bool save_doubles) {
+void MacroAssembler::LeaveExitFrame(bool save_doubles, bool pop_arguments) {
// Optionally restore FPU state.
if (save_doubles) {
const int offset = -2 * kPointerSize;
frstor(MemOperand(ebp, offset - 108));
}
- // Get the return address from the stack and restore the frame pointer.
- mov(ecx, Operand(ebp, 1 * kPointerSize));
- mov(ebp, Operand(ebp, 0 * kPointerSize));
+ if (pop_arguments) {
+ // Get the return address from the stack and restore the frame pointer.
+ mov(ecx, Operand(ebp, 1 * kPointerSize));
+ mov(ebp, Operand(ebp, 0 * kPointerSize));
- // Pop the arguments and the receiver from the caller stack.
- lea(esp, Operand(esi, 1 * kPointerSize));
+ // Pop the arguments and the receiver from the caller stack.
+ lea(esp, Operand(esi, 1 * kPointerSize));
- // Push the return address to get ready to return.
- push(ecx);
+ // Push the return address to get ready to return.
+ push(ecx);
+ } else {
+ // Otherwise just leave the exit frame.
+ leave();
+ }
LeaveExitFrameEpilogue(true);
}
@@ -1033,7 +1038,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
int offset =
Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
mov(scratch1, FieldOperand(scratch1, offset));
- mov(scratch1, FieldOperand(scratch1, GlobalObject::kNativeContextOffset));
+ mov(scratch1, FieldOperand(scratch1, JSGlobalObject::kNativeContextOffset));
// Check the context is a native context.
if (emit_debug_code()) {
@@ -2047,7 +2052,7 @@ void MacroAssembler::GetBuiltinFunction(Register target,
int native_context_index) {
// Load the JavaScript builtin function from the builtins object.
mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
- mov(target, FieldOperand(target, GlobalObject::kNativeContextOffset));
+ mov(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset));
mov(target, ContextOperand(target, native_context_index));
}
@@ -2090,7 +2095,7 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
void MacroAssembler::LoadGlobalProxy(Register dst) {
mov(dst, GlobalObjectOperand());
- mov(dst, FieldOperand(dst, GlobalObject::kGlobalProxyOffset));
+ mov(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset));
}
@@ -2102,7 +2107,7 @@ void MacroAssembler::LoadTransitionedArrayMapConditional(
Label* no_map_match) {
// Load the global or builtins object from the current context.
mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
- mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
+ mov(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
// Check that the function's map is the same as the expected cached map.
mov(scratch, Operand(scratch,
@@ -2125,8 +2130,7 @@ void MacroAssembler::LoadGlobalFunction(int index, Register function) {
mov(function,
Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
// Load the native context from the global or builtins object.
- mov(function,
- FieldOperand(function, GlobalObject::kNativeContextOffset));
+ mov(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset));
// Load the function from the native context.
mov(function, Operand(function, Context::SlotOffset(index)));
}
@@ -2312,6 +2316,27 @@ void MacroAssembler::Lzcnt(Register dst, const Operand& src) {
}
+void MacroAssembler::Tzcnt(Register dst, const Operand& src) {
+ // TODO(intel): Add support for TZCNT (with ABM/BMI1).
+ Label not_zero_src;
+ bsf(dst, src);
+ j(not_zero, &not_zero_src, Label::kNear);
+ Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0.
+ bind(&not_zero_src);
+}
+
+
+void MacroAssembler::Popcnt(Register dst, const Operand& src) {
+ // TODO(intel): Add support for POPCNT (with POPCNT)
+ // if (CpuFeatures::IsSupported(POPCNT)) {
+ // CpuFeatureScope scope(this, POPCNT);
+ // popcnt(dst, src);
+ // return;
+ // }
+ UNREACHABLE();
+}
+
+
void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
if (FLAG_native_code_counters && counter->Enabled()) {
mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));