Revision: 14323
Author:   [email protected]
Date:     Thu Apr 18 02:50:46 2013
Log:      Make it possible to Crankshaft all kinds of stubs.

Review URL: https://codereview.chromium.org/14307006
http://code.google.com/p/v8/source/detail?r=14323

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.h
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/codegen.cc
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/disassembler.cc
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/factory.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/ia32/code-stubs-ia32.h
 /branches/bleeding_edge/src/lithium.cc
 /branches/bleeding_edge/src/lithium.h
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/mips/code-stubs-mips.h
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/safepoint-table.cc
 /branches/bleeding_edge/src/spaces.cc
 /branches/bleeding_edge/src/x64/code-stubs-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.h Sat Apr 6 21:34:20 2013 +++ /branches/bleeding_edge/src/arm/code-stubs-arm.h Thu Apr 18 02:50:46 2013
@@ -130,7 +130,7 @@
   void GenerateGenericStubBitNot(MacroAssembler* masm);
   void GenerateGenericCodeFallback(MacroAssembler* masm);

-  virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }

   virtual InlineCacheState GetICState() {
     return UnaryOpIC::ToState(operand_type_);
=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Wed Apr 17 07:11:39 2013 +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Thu Apr 18 02:50:46 2013
@@ -185,7 +185,7 @@
 static Handle<Code> DoGenerateCode(Stub* stub) {
   CodeStubGraphBuilder<Stub> builder(stub);
   LChunk* chunk = OptimizeGraph(builder.CreateGraph());
-  return chunk->Codegen(Code::COMPILED_STUB);
+  return chunk->Codegen();
 }


@@ -249,7 +249,7 @@
 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
   CodeStubGraphBuilder<FastCloneShallowArrayStub> builder(this);
   LChunk* chunk = OptimizeGraph(builder.CreateGraph());
-  return chunk->Codegen(Code::COMPILED_STUB);
+  return chunk->Codegen();
 }


=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Thu Apr  4 10:55:43 2013
+++ /branches/bleeding_edge/src/code-stubs.cc   Thu Apr 18 02:50:46 2013
@@ -67,7 +67,7 @@
 }


-int CodeStub::GetCodeKind() {
+Code::Kind CodeStub::GetCodeKind() const {
   return Code::STUB;
 }

@@ -98,7 +98,7 @@

   // Copy the generated code into a heap object.
   Code::Flags flags = Code::ComputeFlags(
-      static_cast<Code::Kind>(GetCodeKind()),
+      GetCodeKind(),
       GetICState(),
       GetExtraICState(),
       GetStubType(),
@@ -308,7 +308,7 @@
bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) {
   Factory* factory = isolate->factory();
   Code::Flags flags = Code::ComputeFlags(
-      static_cast<Code::Kind>(GetCodeKind()),
+      GetCodeKind(),
       UNINITIALIZED);
   ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT);
   Handle<Object> probe(
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Thu Apr 11 09:28:19 2013
+++ /branches/bleeding_edge/src/code-stubs.h    Thu Apr 18 02:50:46 2013
@@ -176,19 +176,19 @@
   virtual Major MajorKey() = 0;
   virtual int MinorKey() = 0;

+  virtual InlineCacheState GetICState() {
+    return UNINITIALIZED;
+  }
+  virtual Code::ExtraICState GetExtraICState() {
+    return Code::kNoExtraICState;
+  }
+
  protected:
   static bool CanUseFPRegisters();

   // Generates the assembler code for the stub.
   virtual Handle<Code> GenerateCode() = 0;

-  // BinaryOpStub needs to override this.
-  virtual InlineCacheState GetICState() {
-    return UNINITIALIZED;
-  }
-  virtual Code::ExtraICState GetExtraICState() {
-    return Code::kNoExtraICState;
-  }
   virtual Code::StubType GetStubType() {
     return Code::NORMAL;
   }
@@ -210,7 +210,7 @@
   virtual void Activate(Code* code) { }

   // BinaryOpStub needs to override this.
-  virtual int GetCodeKind();
+  virtual Code::Kind GetCodeKind() const;

   // Add the code to a specialized cache, specific to an individual
   // stub type. Please note, this method must add the code object to a
@@ -249,7 +249,7 @@
   // Retrieve the code for the stub. Generate the code if needed.
   virtual Handle<Code> GenerateCode();

-  virtual int GetCodeKind() { return Code::STUB; }
+  virtual Code::Kind GetCodeKind() const { return Code::STUB; }
   virtual int GetStubFlags() { return -1; }

  protected:
@@ -286,7 +286,7 @@
   // Retrieve the code for the stub. Generate the code if needed.
   virtual Handle<Code> GenerateCode() = 0;

-  virtual int GetCodeKind() { return Code::COMPILED_STUB; }
+  virtual Code::Kind GetCodeKind() const { return Code::STUB; }

   CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) {
     return isolate->code_stub_interface_descriptor(MajorKey());
@@ -606,7 +606,7 @@
 class ICStub: public PlatformCodeStub {
  public:
   explicit ICStub(Code::Kind kind) : kind_(kind) { }
-  virtual int GetCodeKind() { return kind_; }
+  virtual Code::Kind GetCodeKind() const { return kind_; }
   virtual InlineCacheState GetICState() { return MONOMORPHIC; }

   bool Describes(Code* code) {
@@ -692,7 +692,7 @@
 class HandlerStub: public ICStub {
  public:
   explicit HandlerStub(Code::Kind kind) : ICStub(kind) { }
-  virtual int GetCodeKind() { return Code::STUB; }
+  virtual Code::Kind GetCodeKind() const { return Code::STUB; }
   virtual int GetStubFlags() { return kind(); }
 };

@@ -830,7 +830,7 @@
   // Entirely platform-specific methods are defined as static helper
   // functions in the <arch>/code-stubs-<arch>.cc files.

-  virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; }

   virtual InlineCacheState GetICState() {
     return BinaryOpIC::ToState(Max(left_type_, right_type_));
@@ -884,7 +884,7 @@
   virtual CodeStub::Major MajorKey() { return CompareIC; }
   virtual int MinorKey();

-  virtual int GetCodeKind() { return Code::COMPARE_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }

   void GenerateSmis(MacroAssembler* masm);
   void GenerateNumbers(MacroAssembler* masm);
@@ -1548,7 +1548,7 @@
       : tos_(tos), types_(types) { }

   void Generate(MacroAssembler* masm);
-  virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
   virtual void PrintName(StringStream* stream);

   virtual bool SometimesSetsUpAFrame() { return false; }
=======================================
--- /branches/bleeding_edge/src/codegen.cc      Tue Apr  2 00:53:50 2013
+++ /branches/bleeding_edge/src/codegen.cc      Thu Apr 18 02:50:46 2013
@@ -106,10 +106,13 @@

   // Allocate and install the code.
   CodeDesc desc;
+  bool is_crankshafted =
+      Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION ||
+      info->IsStub();
   masm->GetCode(&desc);
   Handle<Code> code =
-      isolate->factory()->NewCode(desc, flags, masm->CodeObject());
-
+      isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
+                                  false, is_crankshafted);
   if (!code.is_null()) {
     isolate->counters()->total_compiled_code_size()->Increment(
         code->instruction_size());
@@ -129,7 +132,7 @@
   if (print_code) {
     // Print the source code if available.
     FunctionLiteral* function = info->function();
-    if (code->kind() != Code::COMPILED_STUB) {
+    if (code->kind() == Code::OPTIMIZED_FUNCTION) {
       Handle<Script> script = info->script();
       if (!script->IsUndefined() && !script->source()->IsUndefined()) {
         PrintF("--- Raw source ---\n");
=======================================
--- /branches/bleeding_edge/src/compiler.cc     Wed Apr 17 08:01:25 2013
+++ /branches/bleeding_edge/src/compiler.cc     Thu Apr 18 02:50:46 2013
@@ -144,7 +144,11 @@

 Code::Flags CompilationInfo::flags() const {
   if (IsStub()) {
-    return Code::ComputeFlags(Code::COMPILED_STUB);
+    return Code::ComputeFlags(code_stub()->GetCodeKind(),
+                              code_stub()->GetICState(),
+                              code_stub()->GetExtraICState(),
+                              Code::NORMAL,
+                              0);
   } else {
     return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION);
   }
@@ -421,7 +425,7 @@
     Timer timer(this, &time_taken_to_codegen_);
     ASSERT(chunk_ != NULL);
     ASSERT(graph_ != NULL);
- Handle<Code> optimized_code = chunk_->Codegen(Code::OPTIMIZED_FUNCTION);
+    Handle<Code> optimized_code = chunk_->Codegen();
     if (optimized_code.is_null()) {
       info()->set_bailout_reason("code generation failed");
       return AbortOptimization();
=======================================
--- /branches/bleeding_edge/src/compiler.h      Thu Mar  7 07:46:14 2013
+++ /branches/bleeding_edge/src/compiler.h      Thu Apr 18 02:50:46 2013
@@ -79,7 +79,7 @@
   Handle<JSFunction> closure() const { return closure_; }
   Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
   Handle<Script> script() const { return script_; }
-  HydrogenCodeStub* code_stub() {return code_stub_; }
+  HydrogenCodeStub* code_stub() const {return code_stub_; }
   v8::Extension* extension() const { return extension_; }
   ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
   Handle<Context> context() const { return context_; }
=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Tue Apr 16 05:30:51 2013
+++ /branches/bleeding_edge/src/deoptimizer.cc  Thu Apr 18 02:50:46 2013
@@ -1195,7 +1195,8 @@
   //                                         reg = JSFunction context
   //

-  ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
+  ASSERT(compiled_code_->is_crankshafted() &&
+         compiled_code_->kind() != Code::OPTIMIZED_FUNCTION);
   int major_key = compiled_code_->major_key();
   CodeStubInterfaceDescriptor* descriptor =
       isolate_->code_stub_interface_descriptor(major_key);
@@ -2133,7 +2134,7 @@
     // size matches with the stack height we can compute based on the
     // environment at the OSR entry. The code for that his built into
     // the DoComputeOsrOutputFrame function for now.
-  } else if (compiled_code_->kind() != Code::COMPILED_STUB) {
+  } else if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
     unsigned stack_slots = compiled_code_->stack_slots();
     unsigned outgoing_size = ComputeOutgoingArgumentSize();
ASSERT(result == fixed_size + (stack_slots * kPointerSize) + outgoing_size);
=======================================
--- /branches/bleeding_edge/src/disassembler.cc Mon Apr 15 08:19:51 2013
+++ /branches/bleeding_edge/src/disassembler.cc Thu Apr 18 02:50:46 2013
@@ -332,8 +332,7 @@
 // Called by Code::CodePrint.
 void Disassembler::Decode(FILE* f, Code* code) {
   Isolate* isolate = code->GetIsolate();
-  int decode_size = (code->kind() == Code::OPTIMIZED_FUNCTION ||
-                     code->kind() == Code::COMPILED_STUB)
+  int decode_size = code->is_crankshafted()
       ? static_cast<int>(code->safepoint_table_offset())
       : code->instruction_size();
   // If there might be a back edge table, stop before reaching it.
=======================================
--- /branches/bleeding_edge/src/factory.cc      Wed Apr 17 08:01:25 2013
+++ /branches/bleeding_edge/src/factory.cc      Thu Apr 18 02:50:46 2013
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2013 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -916,10 +916,11 @@
 Handle<Code> Factory::NewCode(const CodeDesc& desc,
                               Code::Flags flags,
                               Handle<Object> self_ref,
-                              bool immovable) {
+                              bool immovable,
+                              bool crankshafted) {
   CALL_HEAP_FUNCTION(isolate(),
                      isolate()->heap()->CreateCode(
-                         desc, flags, self_ref, immovable),
+                         desc, flags, self_ref, immovable, crankshafted),
                      Code);
 }

=======================================
--- /branches/bleeding_edge/src/factory.h       Wed Apr 17 08:01:25 2013
+++ /branches/bleeding_edge/src/factory.h       Thu Apr 18 02:50:46 2013
@@ -347,7 +347,8 @@
   Handle<Code> NewCode(const CodeDesc& desc,
                        Code::Flags flags,
                        Handle<Object> self_reference,
-                       bool immovable = false);
+                       bool immovable = false,
+                       bool crankshafted = false);

   Handle<Code> CopyCode(Handle<Code> code);

=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Apr 17 08:01:25 2013
+++ /branches/bleeding_edge/src/heap.cc Thu Apr 18 02:50:46 2013
@@ -3752,7 +3752,8 @@
 MaybeObject* Heap::CreateCode(const CodeDesc& desc,
                               Code::Flags flags,
                               Handle<Object> self_reference,
-                              bool immovable) {
+                              bool immovable,
+                              bool crankshafted) {
   // Allocate ByteArray before the Code object, so that we do not risk
   // leaving uninitialized Code object (and breaking the heap).
   ByteArray* reloc_info;
@@ -3796,6 +3797,7 @@
   if (code->is_call_stub() || code->is_keyed_call_stub()) {
     code->set_check_type(RECEIVER_MAP_CHECK);
   }
+  code->set_is_crankshafted(crankshafted);
   code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
   code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value());
   code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Apr 17 08:01:25 2013
+++ /branches/bleeding_edge/src/heap.h  Thu Apr 18 02:50:46 2013
@@ -1142,7 +1142,8 @@
   MUST_USE_RESULT MaybeObject* CreateCode(const CodeDesc& desc,
                                           Code::Flags flags,
                                           Handle<Object> self_reference,
-                                          bool immovable = false);
+                                          bool immovable = false,
+                                          bool crankshafted = false);

   MUST_USE_RESULT MaybeObject* CopyCode(Code* code);

=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.h Wed Mar 6 08:15:01 2013 +++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.h Thu Apr 18 02:50:46 2013
@@ -144,7 +144,7 @@
   void GenerateGenericStubBitNot(MacroAssembler* masm);
   void GenerateGenericCodeFallback(MacroAssembler* masm);

-  virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }

   virtual InlineCacheState GetICState() {
     return UnaryOpIC::ToState(operand_type_);
=======================================
--- /branches/bleeding_edge/src/lithium.cc      Mon Feb 25 06:46:09 2013
+++ /branches/bleeding_edge/src/lithium.cc      Thu Apr 18 02:50:46 2013
@@ -442,7 +442,7 @@
 }


-Handle<Code> LChunk::Codegen(Code::Kind kind) {
+Handle<Code> LChunk::Codegen() {
   MacroAssembler assembler(info()->isolate(), NULL, 0);
   LOG_CODE_EVENT(info()->isolate(),
                  CodeStartLinePosInfoRecordEvent(
@@ -456,11 +456,11 @@
       PrintF("Crankshaft Compiler - ");
     }
     CodeGenerator::MakeCodePrologue(info());
-    Code::Flags flags = Code::ComputeFlags(kind);
+    Code::Flags flags = info()->flags();
     Handle<Code> code =
         CodeGenerator::MakeCodeEpilogue(&assembler, flags, info());
     generator.FinishCode(code);
-
+    code->set_is_crankshafted(true);
     if (!code.is_null()) {
       void* jit_handler_data =
           assembler.positions_recorder()->DetachJITHandlerData();
=======================================
--- /branches/bleeding_edge/src/lithium.h       Wed Mar  6 02:49:34 2013
+++ /branches/bleeding_edge/src/lithium.h       Thu Apr 18 02:50:46 2013
@@ -685,7 +685,7 @@

   Zone* zone() const { return info_->zone(); }

-  Handle<Code> Codegen(Code::Kind kind);
+  Handle<Code> Codegen();

   void set_allocated_double_registers(BitVector* allocated_registers);
   BitVector* allocated_double_registers() {
=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Apr 17 00:53:12 2013
+++ /branches/bleeding_edge/src/log.cc  Thu Apr 18 02:50:46 2013
@@ -1590,7 +1590,6 @@
       case Code::BINARY_OP_IC:   // fall through
       case Code::COMPARE_IC:  // fall through
       case Code::TO_BOOLEAN_IC:  // fall through
-      case Code::COMPILED_STUB:  // fall through
       case Code::STUB:
         description =
             CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true);
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.h Tue Apr 16 04:33:02 2013 +++ /branches/bleeding_edge/src/mips/code-stubs-mips.h Thu Apr 18 02:50:46 2013
@@ -131,7 +131,7 @@
   void GenerateGenericStubBitNot(MacroAssembler* masm);
   void GenerateGenericCodeFallback(MacroAssembler* masm);

-  virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }

   virtual InlineCacheState GetICState() {
     return UnaryOpIC::ToState(operand_type_);
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Tue Apr 16 07:16:30 2013
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Apr 18 02:50:46 2013
@@ -3643,11 +3643,23 @@
   ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
   return ExtractArgumentsCountFromFlags(flags());
 }
+
+
+inline bool Code::is_crankshafted() {
+  return IsCrankshaftedField::decode(
+      READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
+}
+
+
+inline void Code::set_is_crankshafted(bool value) {
+  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
+  int updated = IsCrankshaftedField::update(previous, value);
+  WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
+}


 int Code::major_key() {
   ASSERT(kind() == STUB ||
-         kind() == COMPILED_STUB ||
          kind() == UNARY_OP_IC ||
          kind() == BINARY_OP_IC ||
          kind() == COMPARE_IC ||
@@ -3661,7 +3673,6 @@

 void Code::set_major_key(int major) {
   ASSERT(kind() == STUB ||
-         kind() == COMPILED_STUB ||
          kind() == UNARY_OP_IC ||
          kind() == BINARY_OP_IC ||
          kind() == COMPARE_IC ||
@@ -3774,7 +3785,7 @@


 unsigned Code::stack_slots() {
-  ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
+  ASSERT(is_crankshafted());
   return StackSlotsField::decode(
       READ_UINT32_FIELD(this, kKindSpecificFlags1Offset));
 }
@@ -3782,7 +3793,7 @@

 void Code::set_stack_slots(unsigned slots) {
   CHECK(slots <= (1 << kStackSlotsBitCount));
-  ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
+  ASSERT(is_crankshafted());
   int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
   int updated = StackSlotsField::update(previous, slots);
   WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated);
@@ -3790,7 +3801,7 @@


 unsigned Code::safepoint_table_offset() {
-  ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
+  ASSERT(is_crankshafted());
   return SafepointTableOffsetField::decode(
       READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
 }
@@ -3798,7 +3809,7 @@

 void Code::set_safepoint_table_offset(unsigned offset) {
   CHECK(offset <= (1 << kSafepointTableOffsetBitCount));
-  ASSERT(kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB);
+  ASSERT(is_crankshafted());
   ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
   int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
   int updated = SafepointTableOffsetField::update(previous, offset);
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Apr 16 07:16:30 2013
+++ /branches/bleeding_edge/src/objects.cc      Thu Apr 18 02:50:46 2013
@@ -9313,7 +9313,6 @@
   switch (kind) {
     case FUNCTION: return "FUNCTION";
     case OPTIMIZED_FUNCTION: return "OPTIMIZED_FUNCTION";
-    case COMPILED_STUB: return "COMPILED_STUB";
     case STUB: return "STUB";
     case BUILTIN: return "BUILTIN";
     case LOAD_IC: return "LOAD_IC";
@@ -9613,7 +9612,7 @@
   }
   PrintF("\n");

-  if (kind() == OPTIMIZED_FUNCTION || kind() == COMPILED_STUB) {
+  if (is_crankshafted()) {
     SafepointTable table(this);
     PrintF(out, "Safepoints (size = %u)\n", table.size());
     for (unsigned i = 0; i < table.length(); i++) {
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Apr 17 08:07:31 2013
+++ /branches/bleeding_edge/src/objects.h       Thu Apr 18 02:50:46 2013
@@ -4327,7 +4327,6 @@
   V(FUNCTION)             \
   V(OPTIMIZED_FUNCTION)   \
   V(STUB)                 \
-  V(COMPILED_STUB)        \
   V(BUILTIN)              \
   V(LOAD_IC)              \
   V(KEYED_LOAD_IC)        \
@@ -4470,6 +4469,11 @@
   inline int major_key();
   inline void set_major_key(int value);

+ // For kind STUB or ICs, tells whether or not a code object was generated by
+  // the optimizing compiler (but it may not be an optimized function).
+  bool is_crankshafted();
+  inline void set_is_crankshafted(bool value);
+
   // For stubs, tells whether they should always exist, so that they can be
   // called from other stubs.
   inline bool is_pregenerated();
@@ -4785,15 +4789,22 @@
       kMarkedForDeoptimizationFirstBit,
       kMarkedForDeoptimizationBitCount> {};  // NOLINT

+  // KindSpecificFlags2 layout (ALL)
+  static const int kIsCrankshaftedBit = 0;
+  class IsCrankshaftedField: public BitField<bool,
+      kIsCrankshaftedBit, 1> {};  // NOLINT
+
   // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION)
-  static const int kStubMajorKeyFirstBit = 0;
+  static const int kStubMajorKeyFirstBit = kIsCrankshaftedBit + 1;
   static const int kSafepointTableOffsetFirstBit =
       kStubMajorKeyFirstBit + kStubMajorKeyBits;
-  static const int kSafepointTableOffsetBitCount = 26;
+  static const int kSafepointTableOffsetBitCount = 25;

   STATIC_ASSERT(kStubMajorKeyFirstBit + kStubMajorKeyBits <= 32);
   STATIC_ASSERT(kSafepointTableOffsetFirstBit +
                 kSafepointTableOffsetBitCount <= 32);
+  STATIC_ASSERT(1 + kStubMajorKeyBits +
+                kSafepointTableOffsetBitCount <= 32);

   class SafepointTableOffsetField: public BitField<int,
       kSafepointTableOffsetFirstBit,
@@ -4802,8 +4813,10 @@
       kStubMajorKeyFirstBit, kStubMajorKeyBits> {};  // NOLINT

   // KindSpecificFlags2 layout (FUNCTION)
-  class BackEdgeTableOffsetField: public BitField<int, 0, 31> {};
-  class BackEdgesPatchedForOSRField: public BitField<bool, 31, 1> {};
+  class BackEdgeTableOffsetField: public BitField<int,
+      kIsCrankshaftedBit + 1, 29> {};  // NOLINT
+  class BackEdgesPatchedForOSRField: public BitField<bool,
+      kIsCrankshaftedBit + 1 + 29, 1> {};  // NOLINT

   // Signed field cannot be encoded using the BitField class.
   static const int kArgumentsCountShift = 17;
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Apr 18 01:14:59 2013
+++ /branches/bleeding_edge/src/runtime.cc      Thu Apr 18 02:50:46 2013
@@ -7653,7 +7653,6 @@
   ASSERT(args.length() == 0);
   Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
   ASSERT(isolate->heap()->IsAllocationAllowed());
-  ASSERT(deoptimizer->compiled_code_kind() == Code::COMPILED_STUB);
   delete deoptimizer;
   return isolate->heap()->undefined_value();
 }
@@ -7668,7 +7667,7 @@
   Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
   ASSERT(isolate->heap()->IsAllocationAllowed());

-  ASSERT(deoptimizer->compiled_code_kind() != Code::COMPILED_STUB);
+  ASSERT(deoptimizer->compiled_code_kind() == Code::OPTIMIZED_FUNCTION);

   // Make sure to materialize objects before causing any allocation.
   JavaScriptFrameIterator it(isolate);
=======================================
--- /branches/bleeding_edge/src/safepoint-table.cc      Tue Dec 18 08:25:45 2012
+++ /branches/bleeding_edge/src/safepoint-table.cc      Thu Apr 18 02:50:46 2013
@@ -59,8 +59,7 @@


 SafepointTable::SafepointTable(Code* code) {
-  ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION ||
-         code->kind() == Code::COMPILED_STUB);
+  ASSERT(code->is_crankshafted());
   code_ = code;
Address header = code->instruction_start() + code->safepoint_table_offset();
   length_ = Memory::uint32_at(header + kLengthOffset);
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Wed Apr 10 03:24:24 2013
+++ /branches/bleeding_edge/src/spaces.cc       Thu Apr 18 02:50:46 2013
@@ -1807,7 +1807,6 @@
       CASE(FUNCTION);
       CASE(OPTIMIZED_FUNCTION);
       CASE(STUB);
-      CASE(COMPILED_STUB);
       CASE(BUILTIN);
       CASE(LOAD_IC);
       CASE(KEYED_LOAD_IC);
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.h Mon Mar 4 07:00:57 2013 +++ /branches/bleeding_edge/src/x64/code-stubs-x64.h Thu Apr 18 02:50:46 2013
@@ -138,7 +138,7 @@
   void GenerateGenericStubBitNot(MacroAssembler* masm);
   void GenerateGenericCodeFallback(MacroAssembler* masm);

-  virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
+  virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }

   virtual InlineCacheState GetICState() {
     return UnaryOpIC::ToState(operand_type_);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to