Revision: 3775
Author: [email protected]
Date: Tue Feb  2 10:35:53 2010
Log:
Review URL: http://codereview.chromium.org/555164
http://code.google.com/p/v8/source/detail?r=3775

Modified:
 /branches/bleeding_edge/src/arm/codegen-arm.cc
 /branches/bleeding_edge/src/arm/debug-arm.cc
 /branches/bleeding_edge/src/codegen.cc
 /branches/bleeding_edge/src/codegen.h
 /branches/bleeding_edge/src/frames.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/debug-ia32.cc
 /branches/bleeding_edge/src/x64/codegen-x64.cc
 /branches/bleeding_edge/src/x64/debug-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc      Tue Feb  2 05:40:53 2010
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc      Tue Feb  2 10:35:53 2010
@@ -6180,13 +6180,6 @@
       UNREACHABLE();
   }
 }
-
-
-int CEntryStub::MinorKey() {
-  ASSERT(result_size_ <= 2);
-  // Result returned in r0 or r0+r1 by default.
-  return 0;
-}


 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
@@ -6296,7 +6289,6 @@
                               Label* throw_normal_exception,
                               Label* throw_termination_exception,
                               Label* throw_out_of_memory_exception,
-                              ExitFrame::Mode mode,
                               bool do_gc,
                               bool always_allocate) {
   // r0: result parameter for PerformGC, if any
@@ -6356,7 +6348,7 @@
   // r0:r1: result
   // sp: stack pointer
   // fp: frame pointer
-  __ LeaveExitFrame(mode);
+  __ LeaveExitFrame(mode_);

   // check if we should retry or throw exception
   Label retry;
@@ -6389,7 +6381,7 @@
 }


-void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) {
+void CEntryStub::Generate(MacroAssembler* masm) {
// Called from JavaScript; parameters are on stack as if calling JS function
   // r0: number of arguments including receiver
   // r1: pointer to builtin function
@@ -6397,17 +6389,15 @@
   // sp: stack pointer  (restored as callee's sp after C call)
   // cp: current context  (C callee-saved)

+  // Result returned in r0 or r0+r1 by default.
+
   // NOTE: Invocations of builtins may return failure objects
   // instead of a proper result. The builtin entry handles
   // this by performing a garbage collection and retrying the
   // builtin once.

-  ExitFrame::Mode mode = is_debug_break
-      ? ExitFrame::MODE_DEBUG
-      : ExitFrame::MODE_NORMAL;
-
   // Enter the exit frame that transitions from JavaScript to C++.
-  __ EnterExitFrame(mode);
+  __ EnterExitFrame(mode_);

   // r4: number of arguments (C callee-saved)
   // r5: pointer to builtin function (C callee-saved)
@@ -6422,7 +6412,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                false,
                false);

@@ -6431,7 +6420,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                false);

@@ -6442,7 +6430,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                true);

=======================================
--- /branches/bleeding_edge/src/arm/debug-arm.cc        Fri Jan 29 04:41:11 2010
+++ /branches/bleeding_edge/src/arm/debug-arm.cc        Tue Feb  2 10:35:53 2010
@@ -98,7 +98,7 @@
   __ mov(r0, Operand(0));  // no arguments
   __ mov(r1, Operand(ExternalReference::debug_break()));

-  CEntryStub ceb(1);
+  CEntryStub ceb(1, ExitFrame::MODE_DEBUG);
   __ CallStub(&ceb);

// Restore the register values containing object pointers from the expression
=======================================
--- /branches/bleeding_edge/src/codegen.cc      Mon Feb  1 05:07:53 2010
+++ /branches/bleeding_edge/src/codegen.cc      Tue Feb  2 10:35:53 2010
@@ -477,6 +477,19 @@
     case NEW_OBJECT: GenerateNewObject(masm); break;
   }
 }
+
+
+int CEntryStub::MinorKey() {
+  ASSERT(result_size_ <= 2);
+#ifdef _WIN64
+  const indirect_result = result_size_ > 1;
+#else
+  const bool indirect_result = false;
+#endif
+
+  return ExitFrameModeBits::encode(mode_)
+         | IndirectResultBits::encode(indirect_result > 1);
+}


 bool ApiGetterEntryStub::GetCustomCache(Code** code_out) {
=======================================
--- /branches/bleeding_edge/src/codegen.h       Fri Jan 29 04:41:11 2010
+++ /branches/bleeding_edge/src/codegen.h       Tue Feb  2 10:35:53 2010
@@ -330,25 +330,30 @@

 class CEntryStub : public CodeStub {
  public:
-  explicit CEntryStub(int result_size) : result_size_(result_size) { }
-
-  void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
-
- protected:
-  void GenerateBody(MacroAssembler* masm, bool is_debug_break);
+  explicit CEntryStub(int result_size,
+                      ExitFrame::Mode mode = ExitFrame::MODE_NORMAL)
+      : result_size_(result_size), mode_(mode) { }
+
+  void Generate(MacroAssembler* masm);
+
+ private:
   void GenerateCore(MacroAssembler* masm,
                     Label* throw_normal_exception,
                     Label* throw_termination_exception,
                     Label* throw_out_of_memory_exception,
-                    ExitFrame::Mode mode,
                     bool do_gc,
                     bool always_allocate_scope);
   void GenerateThrowTOS(MacroAssembler* masm);
   void GenerateThrowUncatchable(MacroAssembler* masm,
                                 UncatchableExceptionType type);
- private:
+
   // Number of pointers/values returned.
-  int result_size_;
+  int const result_size_;
+  ExitFrame::Mode const mode_;
+
+  // Minor key encoding
+  class ExitFrameModeBits: public BitField<ExitFrame::Mode, 0, 1> {};
+  class IndirectResultBits: public BitField<bool, 1, 1> {};

   Major MajorKey() { return CEntry; }
   // Minor key must differ if different result_size_ values means different
@@ -385,7 +390,7 @@
 };


-// Mark the debugger statemet to be recognized bu debugger (by the MajorKey) +// Mark the debugger statemet to be recognized by debugger (by the MajorKey)
 class DebugerStatementStub : public CodeStub {
  public:
   DebugerStatementStub() { }
=======================================
--- /branches/bleeding_edge/src/frames.cc       Mon Feb  1 02:34:57 2010
+++ /branches/bleeding_edge/src/frames.cc       Tue Feb  2 10:35:53 2010
@@ -410,7 +410,7 @@
 Code* ExitFrame::code() const {
   Object* code = code_slot();
   if (code->IsSmi()) {
-    return Heap::c_entry_debug_break_code();
+    return Heap::debugger_statement_code();
   } else {
     return Code::cast(code);
   }
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Feb  2 05:33:29 2010
+++ /branches/bleeding_edge/src/heap.cc Tue Feb  2 10:35:53 2010
@@ -1500,7 +1500,7 @@

 void Heap::CreateCEntryDebugBreakStub() {
   DebugerStatementStub stub;
-  set_c_entry_debug_break_code(*stub.GetCode());
+  set_debugger_statement_code(*stub.GetCode());
 }


@@ -1527,7 +1527,7 @@
   //    c_entry_code_ = *stub.GetCode();
   // }
   // {  DebugerStatementStub stub;
-  //    c_entry_debug_break_code_ = *stub.GetCode();
+  //    debugger_statement_code_ = *stub.GetCode();
   // }
   // To workaround the problem, make separate functions without inlining.
   Heap::CreateCEntryStub();
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Jan 27 00:25:48 2010
+++ /branches/bleeding_edge/src/heap.h  Tue Feb  2 10:35:53 2010
@@ -101,7 +101,7 @@
V(Code, js_entry_code, JsEntryCode) \ V(Code, js_construct_entry_code, JsConstructEntryCode) \ V(Code, c_entry_code, CEntryCode) \ - V(Code, c_entry_debug_break_code, CEntryDebugBreakCode) \ + V(Code, debugger_statement_code, DebuggerStatementCode) \ V(FixedArray, number_string_cache, NumberStringCache) \ V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ V(FixedArray, natives_source_cache, NativesSourceCache) \
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Mon Feb 1 05:07:53 2010 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Tue Feb 2 10:35:53 2010
@@ -9071,13 +9071,6 @@
Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
   __ jmp(adaptor, RelocInfo::CODE_TARGET);
 }
-
-
-int CEntryStub::MinorKey() {
-  ASSERT(result_size_ <= 2);
-  // Result returned in eax, or eax+edx if result_size_ is 2.
-  return 0;
-}


 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
@@ -9189,7 +9182,6 @@
                               Label* throw_normal_exception,
                               Label* throw_termination_exception,
                               Label* throw_out_of_memory_exception,
-                              ExitFrame::Mode mode,
                               bool do_gc,
                               bool always_allocate_scope) {
   // eax: result parameter for PerformGC, if any
@@ -9199,6 +9191,8 @@
   // edi: number of arguments including receiver  (C callee-saved)
   // esi: pointer to the first argument (C callee-saved)

+  // Result returned in eax, or eax+edx if result_size_ is 2.
+
   if (do_gc) {
     __ mov(Operand(esp, 0 * kPointerSize), eax);  // Result.
     __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY);
@@ -9239,7 +9233,7 @@
   __ j(zero, &failure_returned, not_taken);

   // Exit the JavaScript to C++ exit frame.
-  __ LeaveExitFrame(mode);
+  __ LeaveExitFrame(mode_);
   __ ret(0);

   // Handling of failure.
@@ -9326,7 +9320,7 @@
 }


-void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) {
+void CEntryStub::Generate(MacroAssembler* masm) {
   // eax: number of arguments including receiver
   // ebx: pointer to C function  (C callee-saved)
   // ebp: frame pointer  (restored after C call)
@@ -9338,12 +9332,8 @@
   // of a proper result. The builtin entry handles this by performing
   // a garbage collection and retrying the builtin (twice).

-  ExitFrame::Mode mode = is_debug_break
-      ? ExitFrame::MODE_DEBUG
-      : ExitFrame::MODE_NORMAL;
-
   // Enter the exit frame that transitions from JavaScript to C++.
-  __ EnterExitFrame(mode);
+  __ EnterExitFrame(mode_);

   // eax: result parameter for PerformGC, if any (setup below)
   // ebx: pointer to builtin function  (C callee-saved)
@@ -9361,7 +9351,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                false,
                false);

@@ -9370,7 +9359,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                false);

@@ -9381,7 +9369,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                true);

=======================================
--- /branches/bleeding_edge/src/ia32/debug-ia32.cc      Tue Feb  2 01:20:19 2010
+++ /branches/bleeding_edge/src/ia32/debug-ia32.cc      Tue Feb  2 10:35:53 2010
@@ -94,7 +94,7 @@
   __ Set(eax, Immediate(0));  // no arguments
   __ mov(ebx, Immediate(ExternalReference::debug_break()));

-  CEntryStub ceb(1);
+  CEntryStub ceb(1, ExitFrame::MODE_DEBUG);
   __ CallStub(&ceb);

// Restore the register values containing object pointers from the expression
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Tue Feb  2 01:20:19 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Tue Feb  2 10:35:53 2010
@@ -7330,21 +7330,6 @@
            Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
   __ ret(0);
 }
-
-
-int CEntryStub::MinorKey() {
-  ASSERT(result_size_ <= 2);
-#ifdef _WIN64
-  // Simple results returned in rax (using default code).
-  // Complex results must be written to address passed as first argument.
-  return (result_size_ < 2) ? 0 : 1;
-#else
- // Single results returned in rax (both AMD64 and Win64 calling conventions) - // and a struct of two pointers in rax+rdx (AMD64 calling convention only)
-  // by default.
-  return 0;
-#endif
-}


 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
@@ -7380,7 +7365,6 @@
                               Label* throw_normal_exception,
                               Label* throw_termination_exception,
                               Label* throw_out_of_memory_exception,
-                              ExitFrame::Mode mode,
                               bool do_gc,
                               bool always_allocate_scope) {
   // rax: result parameter for PerformGC, if any.
@@ -7392,6 +7376,10 @@
   //      This pointer is reused in LeaveExitFrame(), so it is stored in a
   //      callee-saved register.

+ // Simple results returned in rax (both AMD64 and Win64 calling conventions).
+  // Complex results must be written to address passed as first argument.
+  // AMD64 calling convention: a struct of two pointers in rax+rdx
+
   if (do_gc) {
// Pass failure code returned from last attempt as first argument to GC.
 #ifdef _WIN64
@@ -7463,7 +7451,7 @@
   __ j(zero, &failure_returned);

   // Exit the JavaScript to C++ exit frame.
-  __ LeaveExitFrame(mode, result_size_);
+  __ LeaveExitFrame(mode_, result_size_);
   __ ret(0);

   // Handling of failure.
@@ -7607,7 +7595,7 @@
 }


-void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) {
+void CEntryStub::Generate(MacroAssembler* masm) {
   // rax: number of arguments including receiver
   // rbx: pointer to C function  (C callee-saved)
   // rbp: frame pointer of calling JS frame (restored after C call)
@@ -7619,12 +7607,8 @@
   // this by performing a garbage collection and retrying the
   // builtin once.

-  ExitFrame::Mode mode = is_debug_break ?
-      ExitFrame::MODE_DEBUG :
-      ExitFrame::MODE_NORMAL;
-
   // Enter the exit frame that transitions from JavaScript to C++.
-  __ EnterExitFrame(mode, result_size_);
+  __ EnterExitFrame(mode_, result_size_);

   // rax: Holds the context at this point, but should not be used.
   //      On entry to code generated by GenerateCore, it must hold
@@ -7647,7 +7631,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                false,
                false);

@@ -7656,7 +7639,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                false);

@@ -7667,7 +7649,6 @@
                &throw_normal_exception,
                &throw_termination_exception,
                &throw_out_of_memory_exception,
-               mode,
                true,
                true);

=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc        Tue Feb  2 01:20:19 2010
+++ /branches/bleeding_edge/src/x64/debug-x64.cc        Tue Feb  2 10:35:53 2010
@@ -68,7 +68,7 @@
   __ xor_(rax, rax);  // No arguments (argc == 0).
   __ movq(rbx, ExternalReference::debug_break());

-  CEntryStub ceb(1);
+  CEntryStub ceb(1, ExitFrame::MODE_DEBUG);
   __ CallStub(&ceb);

// Restore the register values containing object pointers from the expression

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

Reply via email to