Remove support for branch hints from the IA32 and X64 assembler.

They were not on by default and should not be needed on modern
platforms.
Review URL: http://codereview.chromium.org/7001025

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7866 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 03c00ee6
......@@ -147,7 +147,6 @@ DEFINE_bool(optimize_closures, true, "optimize closures")
DEFINE_bool(debug_code, false,
"generate extra code (assertions) for debugging")
DEFINE_bool(code_comments, false, "emit comments in code disassembly")
DEFINE_bool(emit_branch_hints, false, "emit branch hints")
DEFINE_bool(peephole_optimization, true,
"perform peephole optimizations in assembly code")
DEFINE_bool(print_peephole_optimization, false,
......
......@@ -1423,10 +1423,9 @@ void Assembler::jmp(Handle<Code> code, RelocInfo::Mode rmode) {
}
void Assembler::j(Condition cc, Label* L, Hint hint, Label::Distance distance) {
void Assembler::j(Condition cc, Label* L, Label::Distance distance) {
EnsureSpace ensure_space(this);
ASSERT(0 <= cc && cc < 16);
if (FLAG_emit_branch_hints && hint != no_hint) EMIT(hint);
if (L->is_bound()) {
const int short_size = 2;
const int long_size = 6;
......@@ -1456,10 +1455,9 @@ void Assembler::j(Condition cc, Label* L, Hint hint, Label::Distance distance) {
}
void Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode, Hint hint) {
void Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode) {
EnsureSpace ensure_space(this);
ASSERT((0 <= cc) && (cc < 16));
if (FLAG_emit_branch_hints && hint != no_hint) EMIT(hint);
// 0000 1111 1000 tttn #32-bit disp.
EMIT(0x0F);
EMIT(0x80 | cc);
......@@ -1467,9 +1465,8 @@ void Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode, Hint hint) {
}
void Assembler::j(Condition cc, Handle<Code> code, Hint hint) {
void Assembler::j(Condition cc, Handle<Code> code) {
EnsureSpace ensure_space(this);
if (FLAG_emit_branch_hints && hint != no_hint) EMIT(hint);
// 0000 1111 1000 tttn #32-bit disp
EMIT(0x0F);
EMIT(0x80 | cc);
......
......@@ -249,23 +249,6 @@ inline Condition ReverseCondition(Condition cc) {
}
enum Hint {
no_hint = 0,
not_taken = 0x2e,
taken = 0x3e
};
// The result of negating a hint is as if the corresponding condition
// were negated by NegateCondition. That is, no_hint is mapped to
// itself and not_taken and taken are mapped to each other.
inline Hint NegateHint(Hint hint) {
return (hint == no_hint)
? no_hint
: ((hint == not_taken) ? taken : not_taken);
}
// -----------------------------------------------------------------------------
// Machine instruction Immediates
......@@ -863,13 +846,9 @@ class Assembler : public AssemblerBase {
// Conditional jumps
void j(Condition cc,
Label* L,
Hint hint,
Label::Distance distance = Label::kFar);
void j(Condition cc, Label* L, Label::Distance distance = Label::kFar) {
j(cc, L, no_hint, distance);
}
void j(Condition cc, byte* entry, RelocInfo::Mode rmode, Hint hint = no_hint);
void j(Condition cc, Handle<Code> code, Hint hint = no_hint);
void j(Condition cc, byte* entry, RelocInfo::Mode rmode);
void j(Condition cc, Handle<Code> code);
// Floating-point operations
void fld(int i);
......
......@@ -356,12 +356,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// If the result is a smi, it is *not* an object in the ECMA sense.
__ test(eax, Immediate(kSmiTagMask));
__ j(zero, &use_receiver, not_taken);
__ j(zero, &use_receiver);
// If the type of the result (stored in its map) is less than
// FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense.
__ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
__ j(above_equal, &exit, not_taken);
__ j(above_equal, &exit);
// Throw away the result of the constructor invocation and use the
// on-stack receiver as the result.
......@@ -568,7 +568,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
// 1. Make sure we have at least one argument.
{ Label done;
__ test(eax, Operand(eax));
__ j(not_zero, &done, taken);
__ j(not_zero, &done);
__ pop(ebx);
__ push(Immediate(factory->undefined_value()));
__ push(ebx);
......@@ -582,9 +582,9 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
// 1 ~ return address.
__ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize));
__ test(edi, Immediate(kSmiTagMask));
__ j(zero, &non_function, not_taken);
__ j(zero, &non_function);
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
__ j(not_equal, &non_function, not_taken);
__ j(not_equal, &non_function);
// 3a. Patch the first argument if necessary when calling a function.
......@@ -684,7 +684,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
// 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
{ Label function;
__ test(edi, Operand(edi));
__ j(not_zero, &function, taken);
__ j(not_zero, &function);
__ Set(ebx, Immediate(0));
__ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
__ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
......@@ -733,7 +733,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
__ shl(edx, kPointerSizeLog2 - kSmiTagSize);
// Check if the arguments will overflow the stack.
__ cmp(ecx, Operand(edx));
__ j(greater, &okay, taken); // Signed comparison.
__ j(greater, &okay); // Signed comparison.
// Out of stack space.
__ push(Operand(ebp, 4 * kPointerSize)); // push this
......@@ -1589,7 +1589,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(masm->isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above_equal, &ok, taken, Label::kNear);
__ j(above_equal, &ok, Label::kNear);
StackCheckStub stub;
__ TailCallStub(&stub);
__ Abort("Unreachable code: returned from tail call.");
......
This diff is collapsed.
......@@ -245,7 +245,7 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above_equal, &ok, taken, Label::kNear);
__ j(above_equal, &ok, Label::kNear);
StackCheckStub stub;
__ CallStub(&stub);
__ bind(&ok);
......@@ -278,7 +278,7 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) {
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above_equal, &ok, taken, Label::kNear);
__ j(above_equal, &ok, Label::kNear);
StackCheckStub stub;
__ CallStub(&stub);
// Record a mapping of this PC offset to the OSR id. This is used to find
......@@ -1725,7 +1725,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
__ imul(eax, Operand(ecx));
__ j(overflow, &stub_call);
__ test(eax, Operand(eax));
__ j(not_zero, &done, taken, Label::kNear);
__ j(not_zero, &done, Label::kNear);
__ mov(ebx, edx);
__ or_(ebx, Operand(ecx));
__ j(negative, &stub_call);
......
This diff is collapsed.
......@@ -572,7 +572,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
__ jmp(entry, RelocInfo::RUNTIME_ENTRY);
__ bind(&done);
} else {
__ j(cc, entry, RelocInfo::RUNTIME_ENTRY, not_taken);
__ j(cc, entry, RelocInfo::RUNTIME_ENTRY);
}
}
}
......@@ -1482,7 +1482,7 @@ void LCodeGen::DoCmpID(LCmpID* instr) {
// Don't base result on EFLAGS when a NaN is involved. Instead
// jump to the unordered case, which produces a false value.
__ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right));
__ j(parity_even, &unordered, not_taken, Label::kNear);
__ j(parity_even, &unordered, Label::kNear);
} else {
EmitCmpI(left, right);
}
......@@ -2031,7 +2031,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
// A Smi is not an instance of anything.
__ test(object, Immediate(kSmiTagMask));
__ j(zero, &false_result, not_taken);
__ j(zero, &false_result);
// This is the inlined call site instanceof cache. The two occurences of the
// hole value will be patched to the last map/result pair generated by the
......@@ -2041,7 +2041,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
__ mov(map, FieldOperand(object, HeapObject::kMapOffset));
__ bind(deferred->map_check()); // Label for calculating code patching.
__ cmp(map, factory()->the_hole_value()); // Patched to cached map.
__ j(not_equal, &cache_miss, not_taken, Label::kNear);
__ j(not_equal, &cache_miss, Label::kNear);
__ mov(eax, factory()->the_hole_value()); // Patched to either true or false.
__ jmp(&done);
......@@ -3622,7 +3622,7 @@ void LCodeGen::EmitNumberUntagD(Register input_reg,
// Smi check.
__ test(input_reg, Immediate(kSmiTagMask));
__ j(zero, &load_smi, not_taken, Label::kNear);
__ j(zero, &load_smi, Label::kNear);
// Heap number map check.
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
......
......@@ -513,7 +513,7 @@ void MacroAssembler::Throw(Register value) {
Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
Label skip;
cmp(ebp, 0);
j(equal, &skip, not_taken, Label::kNear);
j(equal, &skip, Label::kNear);
mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
bind(&skip);
......@@ -614,7 +614,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// Check if both contexts are the same.
cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset));
j(equal, &same_contexts, taken);
j(equal, &same_contexts);
// Compare security tokens, save holder_reg on the stack so we can use it
// as a temporary register.
......@@ -644,7 +644,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
mov(scratch, FieldOperand(scratch, token_offset));
cmp(scratch, FieldOperand(holder_reg, token_offset));
pop(holder_reg);
j(not_equal, miss, not_taken);
j(not_equal, miss);
bind(&same_contexts);
}
......@@ -732,9 +732,9 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
mov(top_reg, result);
}
add(Operand(top_reg), Immediate(object_size));
j(carry, gc_required, not_taken);
j(carry, gc_required);
cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit));
j(above, gc_required, not_taken);
j(above, gc_required);
// Update allocation top.
UpdateAllocationTopHelper(top_reg, scratch);
......@@ -831,9 +831,9 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
mov(result_end, object_size);
}
add(result_end, Operand(result));
j(carry, gc_required, not_taken);
j(carry, gc_required);
cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
j(above, gc_required, not_taken);
j(above, gc_required);
// Tag result if requested.
if ((flags & TAG_OBJECT) != 0) {
......@@ -1062,9 +1062,9 @@ void MacroAssembler::NegativeZeroTest(Register result,
Label* then_label) {
Label ok;
test(result, Operand(result));
j(not_zero, &ok, taken);
j(not_zero, &ok);
test(op, Operand(op));
j(sign, then_label, not_taken);
j(sign, then_label);
bind(&ok);
}
......@@ -1076,10 +1076,10 @@ void MacroAssembler::NegativeZeroTest(Register result,
Label* then_label) {
Label ok;
test(result, Operand(result));
j(not_zero, &ok, taken);
j(not_zero, &ok);
mov(scratch, Operand(op1));
or_(scratch, Operand(op2));
j(sign, then_label, not_taken);
j(sign, then_label);
bind(&ok);
}
......@@ -1090,17 +1090,17 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
Label* miss) {
// Check that the receiver isn't a smi.
test(function, Immediate(kSmiTagMask));
j(zero, miss, not_taken);
j(zero, miss);
// Check that the function really is a function.
CmpObjectType(function, JS_FUNCTION_TYPE, result);
j(not_equal, miss, not_taken);
j(not_equal, miss);
// Make sure that the function has an instance prototype.
Label non_instance;
movzx_b(scratch, FieldOperand(result, Map::kBitFieldOffset));
test(scratch, Immediate(1 << Map::kHasNonInstancePrototype));
j(not_zero, &non_instance, not_taken);
j(not_zero, &non_instance);
// Get the prototype or initial map from the function.
mov(result,
......@@ -1110,7 +1110,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
// simply miss the cache instead. This will allow us to allocate a
// prototype object on-demand in the runtime system.
cmp(Operand(result), Immediate(isolate()->factory()->the_hole_value()));
j(equal, miss, not_taken);
j(equal, miss);
// If the function does not have an initial map, we're done.
Label done;
......@@ -1391,7 +1391,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function,
// Check if the result handle holds 0.
test(eax, Operand(eax));
j(zero, &empty_handle, not_taken);
j(zero, &empty_handle);
// It was non-zero. Dereference to get the result value.
mov(eax, Operand(eax, 0));
bind(&prologue);
......@@ -1401,7 +1401,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function,
sub(Operand::StaticVariable(level_address), Immediate(1));
Assert(above_equal, "Invalid HandleScope level");
cmp(edi, Operand::StaticVariable(limit_address));
j(not_equal, &delete_allocated_handles, not_taken);
j(not_equal, &delete_allocated_handles);
bind(&leave_exit_frame);
// Check if the function scheduled an exception.
......@@ -1409,7 +1409,7 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(ApiFunction* function,
ExternalReference::scheduled_exception_address(isolate());
cmp(Operand::StaticVariable(scheduled_exception_address),
Immediate(isolate()->factory()->the_hole_value()));
j(not_equal, &promote_scheduled_exception, not_taken);
j(not_equal, &promote_scheduled_exception);
LeaveApiExitFrame();
ret(stack_space * kPointerSize);
bind(&promote_scheduled_exception);
......@@ -1849,7 +1849,7 @@ void MacroAssembler::AssertFastElements(Register elements) {
void MacroAssembler::Check(Condition cc, const char* msg) {
Label L;
j(cc, &L, taken);
j(cc, &L);
Abort(msg);
// will not return here
bind(&L);
......
......@@ -265,12 +265,12 @@ class MacroAssembler: public Assembler {
// Jump the register contains a smi.
inline void JumpIfSmi(Register value, Label* smi_label) {
test(value, Immediate(kSmiTagMask));
j(zero, smi_label, not_taken);
j(zero, smi_label);
}
// Jump if register contain a non-smi.
inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
test(value, Immediate(kSmiTagMask));
j(not_zero, not_smi_label, not_taken);
j(not_zero, not_smi_label);
}
// Assumes input is a heap object.
......
......@@ -305,7 +305,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
// The length of a capture should not be negative. This can only happen
// if the end of the capture is unrecorded, or at a point earlier than
// the start of the capture.
BranchOrBacktrack(less, on_no_match, not_taken);
BranchOrBacktrack(less, on_no_match);
// If length is zero, either the capture is empty or it is completely
// uncaptured. In either case succeed immediately.
......@@ -348,7 +348,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
__ add(Operand(edi), Immediate(1));
// Compare to end of match, and loop if not done.
__ cmp(edi, Operand(ebx));
__ j(below, &loop, taken);
__ j(below, &loop);
__ jmp(&success);
__ bind(&fail);
......@@ -687,11 +687,11 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ mov(ecx, esp);
__ sub(ecx, Operand::StaticVariable(stack_limit));
// Handle it if the stack pointer is already below the stack limit.
__ j(below_equal, &stack_limit_hit, not_taken);
__ j(below_equal, &stack_limit_hit);
// Check if there is room for the variable number of registers above
// the stack limit.
__ cmp(ecx, num_registers_ * kPointerSize);
__ j(above_equal, &stack_ok, taken);
__ j(above_equal, &stack_ok);
// Exit with OutOfMemory exception. There is not enough space on the stack
// for our working registers.
__ mov(eax, EXCEPTION);
......@@ -1142,8 +1142,7 @@ void RegExpMacroAssemblerIA32::CheckPosition(int cp_offset,
void RegExpMacroAssemblerIA32::BranchOrBacktrack(Condition condition,
Label* to,
Hint hint) {
Label* to) {
if (condition < 0) { // No condition
if (to == NULL) {
Backtrack();
......@@ -1153,10 +1152,10 @@ void RegExpMacroAssemblerIA32::BranchOrBacktrack(Condition condition,
return;
}
if (to == NULL) {
__ j(condition, &backtrack_label_, hint);
__ j(condition, &backtrack_label_);
return;
}
__ j(condition, to, hint);
__ j(condition, to);
}
......@@ -1209,7 +1208,7 @@ void RegExpMacroAssemblerIA32::CheckPreemption() {
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(masm_->isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above, &no_preempt, taken);
__ j(above, &no_preempt);
SafeCall(&check_preempt_label_);
......
......@@ -168,7 +168,7 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
// Equivalent to a conditional branch to the label, unless the label
// is NULL, in which case it is a conditional Backtrack.
void BranchOrBacktrack(Condition condition, Label* to, Hint hint = no_hint);
void BranchOrBacktrack(Condition condition, Label* to);
// Call and return internally in the generated code in a way that
// is GC-safe (i.e., doesn't leave absolute code addresses on the stack)
......
This diff is collapsed.
......@@ -1215,7 +1215,7 @@ void Assembler::int3() {
}
void Assembler::j(Condition cc, Label* L, Hint hint, Label::Distance distance) {
void Assembler::j(Condition cc, Label* L, Label::Distance distance) {
if (cc == always) {
jmp(L);
return;
......@@ -1224,7 +1224,6 @@ void Assembler::j(Condition cc, Label* L, Hint hint, Label::Distance distance) {
}
EnsureSpace ensure_space(this);
ASSERT(is_uint4(cc));
if (FLAG_emit_branch_hints && hint != no_hint) emit(hint);
if (L->is_bound()) {
const int short_size = 2;
const int long_size = 6;
......
......@@ -327,22 +327,6 @@ inline Condition ReverseCondition(Condition cc) {
}
enum Hint {
no_hint = 0,
not_taken = 0x2e,
taken = 0x3e
};
// The result of negating a hint is as if the corresponding condition
// were negated by NegateCondition. That is, no_hint is mapped to
// itself and not_taken and taken are mapped to each other.
inline Hint NegateHint(Hint hint) {
return (hint == no_hint)
? no_hint
: ((hint == not_taken) ? taken : not_taken);
}
// -----------------------------------------------------------------------------
// Machine instruction Immediates
......@@ -1214,11 +1198,7 @@ class Assembler : public AssemblerBase {
// Conditional jumps
void j(Condition cc,
Label* L,
Hint hint,
Label::Distance distance = Label::kFar);
void j(Condition cc, Label* L, Label::Distance distance = Label::kFar) {
j(cc, L, no_hint, distance);
}
void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode);
// Floating-point operations
......
......@@ -4859,9 +4859,9 @@ void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
__ j(either_smi, &miss, Label::kNear);
__ CmpObjectType(rax, JS_OBJECT_TYPE, rcx);
__ j(not_equal, &miss, not_taken, Label::kNear);
__ j(not_equal, &miss, Label::kNear);
__ CmpObjectType(rdx, JS_OBJECT_TYPE, rcx);
__ j(not_equal, &miss, not_taken, Label::kNear);
__ j(not_equal, &miss, Label::kNear);
ASSERT(GetCondition() == equal);
__ subq(rax, rdx);
......
......@@ -102,7 +102,7 @@ TEST(AssemblerIa321) {
__ bind(&C);
__ test(edx, Operand(edx));
__ j(not_zero, &L, taken);
__ j(not_zero, &L);
__ ret(0);
CodeDesc desc;
......@@ -140,7 +140,7 @@ TEST(AssemblerIa322) {
__ bind(&C);
__ test(edx, Operand(edx));
__ j(not_zero, &L, taken);
__ j(not_zero, &L);
__ ret(0);
// some relocated stuff here, not executed
......@@ -351,10 +351,10 @@ TEST(AssemblerIa329) {
__ fld_d(Operand(esp, 3 * kPointerSize));
__ fld_d(Operand(esp, 1 * kPointerSize));
__ FCmp();
__ j(parity_even, &nan_l, taken);
__ j(equal, &equal_l, taken);
__ j(below, &less_l, taken);
__ j(above, &greater_l, taken);
__ j(parity_even, &nan_l);
__ j(equal, &equal_l);
__ j(below, &less_l);
__ j(above, &greater_l);
__ mov(eax, kUndefined);
__ ret(0);
......
......@@ -330,11 +330,6 @@ TEST(DisasmIa320) {
__ j(less_equal, &Ljcc);
__ j(greater, &Ljcc);
// checking hints
__ j(zero, &Ljcc, taken);
__ j(zero, &Ljcc, not_taken);
// __ mov(Operand::StaticVariable(Isolate::handler_address()), eax);
// 0xD9 instructions
__ nop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment