| Index: src/ia32/macro-assembler-ia32.cc
|
| ===================================================================
|
| --- src/ia32/macro-assembler-ia32.cc (revision 7180)
|
| +++ src/ia32/macro-assembler-ia32.cc (working copy)
|
| @@ -120,7 +120,7 @@
|
| Register addr,
|
| Register scratch,
|
| SaveFPRegsMode save_fp) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| // Check that the object is not in new space.
|
| Label not_in_new_space;
|
| InNewSpace(object, scratch, not_equal, ¬_in_new_space);
|
| @@ -198,7 +198,7 @@
|
|
|
| // Clobber all input registers when running with the debug-code flag
|
| // turned on to provoke errors.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| mov(object, Immediate(BitCast<int32_t>(kZapValue)));
|
| mov(value, Immediate(BitCast<int32_t>(kZapValue)));
|
| mov(scratch, Immediate(BitCast<int32_t>(kZapValue)));
|
| @@ -227,7 +227,7 @@
|
|
|
| // Clobber all input registers when running with the debug-code flag
|
| // turned on to provoke errors.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| mov(object, Immediate(BitCast<int32_t>(kZapValue)));
|
| mov(address, Immediate(BitCast<int32_t>(kZapValue)));
|
| mov(value, Immediate(BitCast<int32_t>(kZapValue)));
|
| @@ -371,7 +371,7 @@
|
| push(esi);
|
| push(Immediate(Smi::FromInt(type)));
|
| push(Immediate(CodeObject()));
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| cmp(Operand(esp, 0), Immediate(Factory::undefined_value()));
|
| Check(not_equal, "code object not properly patched");
|
| }
|
| @@ -379,7 +379,7 @@
|
|
|
|
|
| void MacroAssembler::LeaveFrame(StackFrame::Type type) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset),
|
| Immediate(Smi::FromInt(type)));
|
| Check(equal, "stack frame types must match");
|
| @@ -636,7 +636,7 @@
|
| mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset));
|
|
|
| // When generating debug code, make sure the lexical context is set.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| cmp(Operand(scratch), Immediate(0));
|
| Check(not_equal, "we should not have an empty lexical context");
|
| }
|
| @@ -646,7 +646,7 @@
|
| mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
|
|
|
| // Check the context is a global context.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| push(scratch);
|
| // Read the first word and compare to global_context_map.
|
| mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset));
|
| @@ -670,7 +670,7 @@
|
| mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset));
|
|
|
| // Check the context is a global context.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| cmp(holder_reg, Factory::null_value());
|
| Check(not_equal, "JSGlobalProxy::context() should not be null.");
|
|
|
| @@ -723,7 +723,7 @@
|
|
|
| void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
|
| Register scratch) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| test(result_end, Immediate(kObjectAlignmentMask));
|
| Check(zero, "Unaligned allocation in new space");
|
| }
|
| @@ -747,7 +747,7 @@
|
| Label* gc_required,
|
| AllocationFlags flags) {
|
| if (!FLAG_inline_new) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| // Trash the registers to simulate an allocation failure.
|
| mov(result, Immediate(0x7091));
|
| if (result_end.is_valid()) {
|
| @@ -804,7 +804,7 @@
|
| Label* gc_required,
|
| AllocationFlags flags) {
|
| if (!FLAG_inline_new) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| // Trash the registers to simulate an allocation failure.
|
| mov(result, Immediate(0x7091));
|
| mov(result_end, Immediate(0x7191));
|
| @@ -850,7 +850,7 @@
|
| Label* gc_required,
|
| AllocationFlags flags) {
|
| if (!FLAG_inline_new) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| // Trash the registers to simulate an allocation failure.
|
| mov(result, Immediate(0x7091));
|
| mov(result_end, Immediate(0x7191));
|
| @@ -1368,7 +1368,7 @@
|
| // If false, it is returned as a pointer to a preallocated by caller memory
|
| // region. Pointer to this region should be passed to a function as an
|
| // implicit first argument.
|
| -#if defined(USING_BSD_ABI) || defined(__MINGW32__)
|
| +#if defined(USING_BSD_ABI) || defined(__MINGW32__) || defined(__CYGWIN__)
|
| static const bool kReturnHandlesDirectly = true;
|
| #else
|
| static const bool kReturnHandlesDirectly = false;
|
| @@ -1405,7 +1405,7 @@
|
| // pointer to out cell.
|
| lea(scratch, Operand(esp, (argc + 1) * kPointerSize));
|
| mov(Operand(esp, 0 * kPointerSize), scratch); // output.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| mov(Operand(esp, (argc + 1) * kPointerSize), Immediate(0)); // out cell.
|
| }
|
| }
|
| @@ -1509,7 +1509,7 @@
|
| const ParameterCount& actual,
|
| Handle<Code> code_constant,
|
| const Operand& code_operand,
|
| - Label* done,
|
| + NearLabel* done,
|
| InvokeFlag flag,
|
| PostCallGenerator* post_call_generator) {
|
| bool definitely_matches = false;
|
| @@ -1577,7 +1577,7 @@
|
| const ParameterCount& actual,
|
| InvokeFlag flag,
|
| PostCallGenerator* post_call_generator) {
|
| - Label done;
|
| + NearLabel done;
|
| InvokePrologue(expected, actual, Handle<Code>::null(), code,
|
| &done, flag, post_call_generator);
|
| if (flag == CALL_FUNCTION) {
|
| @@ -1597,7 +1597,7 @@
|
| RelocInfo::Mode rmode,
|
| InvokeFlag flag,
|
| PostCallGenerator* post_call_generator) {
|
| - Label done;
|
| + NearLabel done;
|
| Operand dummy(eax);
|
| InvokePrologue(expected, actual, code, dummy, &done,
|
| flag, post_call_generator);
|
| @@ -1706,7 +1706,7 @@
|
| // (i.e., the static scope chain and runtime context chain do not agree).
|
| // A variable occurring in such a scope should have slot type LOOKUP and
|
| // not CONTEXT.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| cmp(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX)));
|
| Check(equal, "Yo dawg, I heard you liked function contexts "
|
| "so I put function contexts in all your contexts");
|
| @@ -1728,7 +1728,7 @@
|
| Register map) {
|
| // Load the initial map. The global functions all have initial maps.
|
| mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| Label ok, fail;
|
| CheckMap(map, Factory::meta_map(), &fail, false);
|
| jmp(&ok);
|
| @@ -1739,6 +1739,28 @@
|
| }
|
|
|
|
|
| +// Store the value in register src in the safepoint register stack
|
| +// slot for register dst.
|
| +void MacroAssembler::StoreToSafepointRegisterSlot(Register dst, Register src) {
|
| + mov(SafepointRegisterSlot(dst), src);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::StoreToSafepointRegisterSlot(Register dst, Immediate src) {
|
| + mov(SafepointRegisterSlot(dst), src);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) {
|
| + mov(dst, SafepointRegisterSlot(src));
|
| +}
|
| +
|
| +
|
| +Operand MacroAssembler::SafepointRegisterSlot(Register reg) {
|
| + return Operand(esp, SafepointRegisterStackIndex(reg.code()) * kPointerSize);
|
| +}
|
| +
|
| +
|
| int MacroAssembler::SafepointRegisterStackIndex(int reg_code) {
|
| // The registers are pushed starting with the lowest encoding,
|
| // which means that lowest encodings are furthest away from
|
| @@ -1850,12 +1872,12 @@
|
|
|
|
|
| void MacroAssembler::Assert(Condition cc, const char* msg) {
|
| - if (FLAG_debug_code) Check(cc, msg);
|
| + if (emit_debug_code()) Check(cc, msg);
|
| }
|
|
|
|
|
| void MacroAssembler::AssertFastElements(Register elements) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| Label ok;
|
| cmp(FieldOperand(elements, HeapObject::kMapOffset),
|
| Immediate(Factory::fixed_array_map()));
|
| @@ -1923,7 +1945,7 @@
|
| void MacroAssembler::JumpIfNotNumber(Register reg,
|
| TypeInfo info,
|
| Label* on_not_number) {
|
| - if (FLAG_debug_code) AbortIfSmi(reg);
|
| + if (emit_debug_code()) AbortIfSmi(reg);
|
| if (!info.IsNumber()) {
|
| cmp(FieldOperand(reg, HeapObject::kMapOffset),
|
| Factory::heap_number_map());
|
| @@ -1937,7 +1959,7 @@
|
| Register scratch,
|
| TypeInfo info,
|
| Label* on_not_int32) {
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| AbortIfSmi(source);
|
| AbortIfNotNumber(source);
|
| }
|
| @@ -2057,7 +2079,7 @@
|
| void MacroAssembler::CallCFunction(Register function,
|
| int num_arguments) {
|
| // Check stack alignment.
|
| - if (FLAG_debug_code) {
|
| + if (emit_debug_code()) {
|
| CheckStackAlignment();
|
| }
|
|
|
|
|