Author: [EMAIL PROTECTED]
Date: Mon Nov 10 22:10:07 2008
New Revision: 728

Modified:
    branches/bleeding_edge/src/assembler-ia32.cc
    branches/bleeding_edge/src/assembler-ia32.h
    branches/bleeding_edge/src/builtins-ia32.cc
    branches/bleeding_edge/src/codegen-ia32.cc
    branches/bleeding_edge/src/ic-ia32.cc
    branches/bleeding_edge/src/macro-assembler-ia32.cc
    branches/bleeding_edge/src/stub-cache-ia32.cc

Log:
Use shorter encoding for mov REG, IMM.  Use Set() in two places to generate  
smaller code when the immediate is 0.

Modified: branches/bleeding_edge/src/assembler-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/assembler-ia32.cc        (original)
+++ branches/bleeding_edge/src/assembler-ia32.cc        Mon Nov 10 22:10:07 2008
@@ -597,6 +597,14 @@
  }


+void Assembler::mov(Register dst, const Immediate& x) {
+  EnsureSpace ensure_space(this);
+  last_pc_ = pc_;
+  EMIT(0xB8 | dst.code());
+  emit(x);
+}
+
+
  void Assembler::mov(Register dst, Handle<Object> handle) {
    EnsureSpace ensure_space(this);
    last_pc_ = pc_;
@@ -610,6 +618,14 @@
    last_pc_ = pc_;
    EMIT(0x8B);
    emit_operand(dst, src);
+}
+
+
+void Assembler::mov(Register dst, Register src) {
+  EnsureSpace ensure_space(this);
+  last_pc_ = pc_;
+  EMIT(0x89);
+  EMIT(0xC0 | src.code() << 3 | dst.code());
  }



Modified: branches/bleeding_edge/src/assembler-ia32.h
==============================================================================
--- branches/bleeding_edge/src/assembler-ia32.h (original)
+++ branches/bleeding_edge/src/assembler-ia32.h Mon Nov 10 22:10:07 2008
@@ -453,8 +453,10 @@
    void mov_w(const Operand& dst, Register src);

    void mov(Register dst, int32_t imm32);
+  void mov(Register dst, const Immediate& x);
    void mov(Register dst, Handle<Object> handle);
    void mov(Register dst, const Operand& src);
+  void mov(Register dst, Register src);
    void mov(const Operand& dst, const Immediate& x);
    void mov(const Operand& dst, Handle<Object> handle);
    void mov(const Operand& dst, Register src);

Modified: branches/bleeding_edge/src/builtins-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/builtins-ia32.cc (original)
+++ branches/bleeding_edge/src/builtins-ia32.cc Mon Nov 10 22:10:07 2008
@@ -129,7 +129,7 @@
      // ebx: JSObject
      // edi: start of next object
      __ mov(Operand(ebx, JSObject::kMapOffset), eax);
-    __ mov(Operand(ecx), Factory::empty_fixed_array());
+    __ mov(ecx, Factory::empty_fixed_array());
      __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
      __ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
      // Set extra fields in the newly allocated object.
@@ -137,7 +137,7 @@
      // ebx: JSObject
      // edi: start of next object
      { Label loop, entry;
-      __ mov(Operand(edx), Factory::undefined_value());
+      __ mov(edx, Factory::undefined_value());
        __ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
        __ jmp(&entry);
        __ bind(&loop);
@@ -198,7 +198,7 @@
      // edi: FixedArray
      // ecx: start of next object
      { Label loop, entry;
-      __ mov(Operand(edx), Factory::undefined_value());
+      __ mov(edx, Factory::undefined_value());
        __ lea(eax, Operand(edi, FixedArray::kHeaderSize));
        __ jmp(&entry);
        __ bind(&loop);
@@ -440,7 +440,7 @@
      __ push(edi);  // save edi across the call
      __ push(ebx);
      __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
-    __ mov(Operand(ebx), eax);
+    __ mov(ebx, eax);
      __ pop(edi);  // restore edi after the call

      // Get the arguments count and untag it.
@@ -778,7 +778,7 @@
    __ RecordComment("// Calling from debug break to runtime - come in -  
over");
  #endif
    __ Set(eax, Immediate(0));  // no arguments
-  __ mov(Operand(ebx), Immediate(ExternalReference::debug_break()));
+  __ mov(ebx, Immediate(ExternalReference::debug_break()));

    CEntryDebugBreakStub ceb;
    __ CallStub(&ceb);

Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc  (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc  Mon Nov 10 22:10:07 2008
@@ -1041,7 +1041,7 @@
        } else {
          deferred = new DeferredInlinedSmiSubReversed(this, edx,  
overwrite_mode);
          __ mov(edx, Operand(eax));
-        __ mov(Operand(eax), Immediate(value));
+        __ mov(eax, Immediate(value));
          __ sub(eax, Operand(edx));
        }
        __ j(overflow, deferred->enter(), not_taken);
@@ -1265,7 +1265,7 @@
    CompareStub stub(cc_, strict_);
    // Setup parameters and call stub.
    __ mov(edx, Operand(eax));
-  __ mov(Operand(eax), Immediate(Smi::FromInt(value_)));
+  __ Set(eax, Immediate(Smi::FromInt(value_)));
    __ CallStub(&stub);
    __ cmp(eax, 0);
    // "result" is returned in the flags
@@ -4984,7 +4984,7 @@
    // running with --gc-greedy set.
    if (FLAG_gc_greedy) {
      Failure* failure = Failure::RetryAfterGC(0);
-    __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure)));
+    __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure)));
    }
    GenerateCore(masm, &throw_normal_exception,
                 &throw_out_of_memory_exception,
@@ -5002,7 +5002,7 @@

    // Do full GC and retry runtime call one final time.
    Failure* failure = Failure::InternalError();
-  __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure)));
+  __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure)));
    GenerateCore(masm,
                 &throw_normal_exception,
                 &throw_out_of_memory_exception,
@@ -5068,10 +5068,10 @@
    // stub, because the builtin stubs may not have been generated yet.
    if (is_construct) {
      ExternalReference  
construct_entry(Builtins::JSConstructEntryTrampoline);
-    __ mov(Operand(edx), Immediate(construct_entry));
+    __ mov(edx, Immediate(construct_entry));
    } else {
      ExternalReference entry(Builtins::JSEntryTrampoline);
-    __ mov(Operand(edx), Immediate(entry));
+    __ mov(edx, Immediate(entry));
    }
    __ mov(edx, Operand(edx, 0));  // deref address
    __ lea(edx, FieldOperand(edx, Code::kHeaderSize));

Modified: branches/bleeding_edge/src/ic-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/ic-ia32.cc       (original)
+++ branches/bleeding_edge/src/ic-ia32.cc       Mon Nov 10 22:10:07 2008
@@ -543,12 +543,12 @@

    // Call the entry.
    CEntryStub stub;
-  __ mov(Operand(eax), Immediate(2));
-  __ mov(Operand(ebx), Immediate(f));
+  __ mov(eax, Immediate(2));
+  __ mov(ebx, Immediate(f));
    __ CallStub(&stub);

    // Move result to edi and exit the internal frame.
-  __ mov(Operand(edi), eax);
+  __ mov(edi, eax);
    __ LeaveInternalFrame();

    // Check if the receiver is a global object of some sort.

Modified: branches/bleeding_edge/src/macro-assembler-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/macro-assembler-ia32.cc  (original)
+++ branches/bleeding_edge/src/macro-assembler-ia32.cc  Mon Nov 10 22:10:07  
2008
@@ -293,7 +293,7 @@
    if (x.is_zero()) {
      xor_(dst, Operand(dst));  // shorter than mov
    } else {
-    mov(Operand(dst), x);
+    mov(dst, x);
    }
  }

@@ -695,7 +695,7 @@
    if (num_arguments > 0) {
      add(Operand(esp), Immediate(num_arguments * kPointerSize));
    }
-  mov(Operand(eax), Immediate(Factory::undefined_value()));
+  mov(eax, Immediate(Factory::undefined_value()));
  }


@@ -726,14 +726,14 @@
    // arguments passed in because it is constant. At some point we
    // should remove this need and make the runtime routine entry code
    // smarter.
-  mov(Operand(eax), Immediate(num_arguments));
+  Set(eax, Immediate(num_arguments));
    JumpToBuiltin(ext);
  }


  void MacroAssembler::JumpToBuiltin(const ExternalReference& ext) {
    // Set the entry point and jump to the C entry runtime stub.
-  mov(Operand(ebx), Immediate(ext));
+  mov(ebx, Immediate(ext));
    CEntryStub ces;
    jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
  }
@@ -787,7 +787,7 @@
      Handle<Code> adaptor =
           
Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
      if (!code_constant.is_null()) {
-      mov(Operand(edx), Immediate(code_constant));
+      mov(edx, Immediate(code_constant));
        add(Operand(edx), Immediate(Code::kHeaderSize - kHeapObjectTag));
      } else if (!code_operand.is_reg(edx)) {
        mov(edx, code_operand);

Modified: branches/bleeding_edge/src/stub-cache-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/stub-cache-ia32.cc       (original)
+++ branches/bleeding_edge/src/stub-cache-ia32.cc       Mon Nov 10 22:10:07 2008
@@ -395,7 +395,7 @@
    if ((transition != NULL) && (object->map()->unused_property_fields() ==  
0)) {
      // The properties must be extended before we can store the value.
      // We jump to a runtime call that extends the propeties array.
-    __ mov(Operand(ecx), Immediate(Handle<Map>(transition)));
+    __ mov(ecx, Immediate(Handle<Map>(transition)));
      Handle<Code> ic(Builtins::builtin(storage_extend));
      __ jmp(ic, RelocInfo::CODE_TARGET);
      return;
@@ -628,7 +628,7 @@
    }

    // Get the function and setup the context.
-  __ mov(Operand(edi), Immediate(Handle<JSFunction>(function)));
+  __ mov(edi, Immediate(Handle<JSFunction>(function)));
    __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));

    // Jump to the cached code (tail call).
@@ -681,14 +681,14 @@
    // Perform call.
    ExternalReference load_interceptor =
        ExternalReference(IC_Utility(IC::kLoadInterceptorProperty));
-  __ mov(Operand(eax), Immediate(3));
-  __ mov(Operand(ebx), Immediate(load_interceptor));
+  __ mov(eax, Immediate(3));
+  __ mov(ebx, Immediate(load_interceptor));

    CEntryStub stub;
    __ CallStub(&stub);

    // Move result to edi and restore receiver.
-  __ mov(Operand(edi), eax);
+  __ mov(edi, eax);
    __ mov(edx, Operand(ebp, (argc + 2) * kPointerSize));  // receiver

    // Exit frame.
@@ -750,7 +750,7 @@

    // Handle store cache miss.
    __ bind(&miss);
-  __ mov(Operand(ecx), Immediate(Handle<String>(name)));  // restore name
+  __ mov(ecx, Immediate(Handle<String>(name)));  // restore name
    Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
    __ jmp(ic, RelocInfo::CODE_TARGET);

@@ -807,7 +807,7 @@

    // Handle store cache miss.
    __ bind(&miss);
-  __ mov(Operand(ecx), Immediate(Handle<String>(name)));  // restore name
+  __ mov(ecx, Immediate(Handle<String>(name)));  // restore name
    Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
    __ jmp(ic, RelocInfo::CODE_TARGET);

@@ -862,7 +862,7 @@

    // Handle store cache miss.
    __ bind(&miss);
-  __ mov(Operand(ecx), Immediate(Handle<String>(name)));  // restore name
+  __ mov(ecx, Immediate(Handle<String>(name)));  // restore name
    Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
    __ jmp(ic, RelocInfo::CODE_TARGET);


--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to