Revision: 20963
Author:   [email protected]
Date:     Fri Apr 25 08:40:23 2014 UTC
Log: Added an Isolate* field to NoTrackDoubleFieldsForSerializerScope, PlatformFeatureScope and BinaryOpIC::State.

The serializer state and even the CPU features will be per-Isolate
later. Currently we get away with global state, because mksnapshot
runs single-threaded and has only 1 Isolate, but this will change.
Furthermore, these changes are yet another prerequisite for removing a
catch-22 at initialization time when we try to enable serialization.

This CL is similar in spirit to r20919, BTW.

BUG=359977
LOG=y
[email protected]

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

Modified:
 /branches/bleeding_edge/src/assembler.cc
 /branches/bleeding_edge/src/assembler.h
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/ia32/builtins-ia32.cc
 /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/ic.h
 /branches/bleeding_edge/src/type-info.cc

=======================================
--- /branches/bleeding_edge/src/assembler.cc    Tue Apr 22 12:50:58 2014 UTC
+++ /branches/bleeding_edge/src/assembler.cc    Fri Apr 25 08:40:23 2014 UTC
@@ -213,8 +213,8 @@
// -----------------------------------------------------------------------------
 // Implementation of PlatformFeatureScope

-PlatformFeatureScope::PlatformFeatureScope(CpuFeature f)
-    : old_cross_compile_(CpuFeatures::cross_compile_) {
+PlatformFeatureScope::PlatformFeatureScope(Isolate* isolate, CpuFeature f)
+    : isolate_(isolate), old_cross_compile_(CpuFeatures::cross_compile_) {
   // CpuFeatures is a global singleton, therefore this is only safe in
   // single threaded code.
   ASSERT(Serializer::enabled());
=======================================
--- /branches/bleeding_edge/src/assembler.h     Tue Apr 22 12:50:58 2014 UTC
+++ /branches/bleeding_edge/src/assembler.h     Fri Apr 25 08:40:23 2014 UTC
@@ -158,10 +158,11 @@
 // different CPU.
 class PlatformFeatureScope BASE_EMBEDDED {
  public:
-  explicit PlatformFeatureScope(CpuFeature f);
+  PlatformFeatureScope(Isolate* isolate, CpuFeature f);
   ~PlatformFeatureScope();

  private:
+  Isolate* isolate_;
   uint64_t old_cross_compile_;
 };

=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Thu Apr 24 12:07:40 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Fri Apr 25 08:40:23 2014 UTC
@@ -2505,7 +2505,8 @@

 class NoTrackDoubleFieldsForSerializerScope {
  public:
- NoTrackDoubleFieldsForSerializerScope() : flag_(FLAG_track_double_fields) {
+  explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate)
+      : isolate_(isolate), flag_(FLAG_track_double_fields) {
     if (Serializer::enabled()) {
       // Disable tracking double fields because heap numbers treated as
       // immutable by the serializer.
@@ -2519,6 +2520,7 @@
   }

  private:
+  Isolate* isolate_;
   bool flag_;
 };

@@ -2529,7 +2531,7 @@
                  v8::ExtensionConfiguration* extensions)
     : isolate_(isolate),
       active_(isolate->bootstrapper()) {
- NoTrackDoubleFieldsForSerializerScope disable_double_tracking_for_serializer;
+  NoTrackDoubleFieldsForSerializerScope disable_scope(isolate);
   result_ = Handle<Context>::null();
   // If V8 cannot be initialized, just return.
   if (!V8::Initialize(NULL)) return;
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Thu Apr 24 12:07:40 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Fri Apr 25 08:40:23 2014 UTC
@@ -1123,7 +1123,7 @@
 class BinaryOpICStub : public HydrogenCodeStub {
  public:
   BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode)
-      : HydrogenCodeStub(isolate, UNINITIALIZED), state_(op, mode) {}
+ : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {}

   BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
       : HydrogenCodeStub(isolate), state_(state) {}
=======================================
--- /branches/bleeding_edge/src/ia32/builtins-ia32.cc Thu Apr 24 06:25:42 2014 UTC +++ /branches/bleeding_edge/src/ia32/builtins-ia32.cc Fri Apr 25 08:40:23 2014 UTC
@@ -703,7 +703,7 @@

void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
   if (Serializer::enabled()) {
-    PlatformFeatureScope sse2(SSE2);
+    PlatformFeatureScope sse2(masm->isolate(), SSE2);
     Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
   } else {
     Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Thu Apr 24 12:07:40 2014 UTC +++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Fri Apr 25 08:40:23 2014 UTC
@@ -2517,7 +2517,7 @@
   ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
   CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
   if (Serializer::enabled()) {
-    PlatformFeatureScope sse2(SSE2);
+    PlatformFeatureScope sse2(isolate, SSE2);
     BinaryOpICStub::GenerateAheadOfTime(isolate);
     BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
   } else {
=======================================
--- /branches/bleeding_edge/src/ic.cc   Thu Apr 24 12:07:40 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc   Fri Apr 25 08:40:23 2014 UTC
@@ -2058,7 +2058,8 @@
 }


-BinaryOpIC::State::State(ExtraICState extra_ic_state) {
+BinaryOpIC::State::State(Isolate* isolate, ExtraICState extra_ic_state)
+    : isolate_(isolate) {
// We don't deserialize the SSE2 Field, since this is only used to be able
   // to include SSE2 as well as non-SSE2 versions in the snapshot. For code
   // generation we always want it to reflect the current state.
@@ -2109,7 +2110,7 @@
   // Generated list of commonly used stubs
 #define GENERATE(op, left_kind, right_kind, result_kind, mode)  \
   do {                                                          \
-    State state(op, mode);                                      \
+    State state(isolate, op, mode);                             \
     state.left_kind_ = left_kind;                               \
     state.fixed_right_arg_.has_value = false;                   \
     state.right_kind_ = right_kind;                             \
@@ -2304,7 +2305,7 @@
 #undef GENERATE
 #define GENERATE(op, left_kind, fixed_right_arg_value, result_kind, mode) \
   do {                                                                    \
-    State state(op, mode);                                                \
+    State state(isolate, op, mode);                                       \
     state.left_kind_ = left_kind;                                         \
     state.fixed_right_arg_.has_value = true;                              \
     state.fixed_right_arg_.value = fixed_right_arg_value;                 \
@@ -2482,7 +2483,7 @@
     Handle<AllocationSite> allocation_site,
     Handle<Object> left,
     Handle<Object> right) {
-  State state(target()->extra_ic_state());
+  State state(isolate(), target()->extra_ic_state());

   // Compute the actual result using the builtin for the binary operation.
   Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
@@ -2499,7 +2500,7 @@
   // update the state of this very IC, so we must update the stored state.
   UpdateTarget();
   // Compute the new state.
-  State old_state(target()->extra_ic_state());
+  State old_state(isolate(), target()->extra_ic_state());
   state.Update(left, right, result);

   // Check if we have a string operation here.
=======================================
--- /branches/bleeding_edge/src/ic.h    Thu Apr 24 11:44:22 2014 UTC
+++ /branches/bleeding_edge/src/ic.h    Fri Apr 25 08:40:23 2014 UTC
@@ -743,11 +743,11 @@
  public:
   class State V8_FINAL BASE_EMBEDDED {
    public:
-    explicit State(ExtraICState extra_ic_state);
+    State(Isolate* isolate, ExtraICState extra_ic_state);

-    State(Token::Value op, OverwriteMode mode)
+    State(Isolate* isolate, Token::Value op, OverwriteMode mode)
         : op_(op), mode_(mode), left_kind_(NONE), right_kind_(NONE),
-          result_kind_(NONE) {
+          result_kind_(NONE), isolate_(isolate) {
       ASSERT_LE(FIRST_TOKEN, op);
       ASSERT_LE(op, LAST_TOKEN);
     }
@@ -823,6 +823,8 @@
     void Update(Handle<Object> left,
                 Handle<Object> right,
                 Handle<Object> result);
+
+    Isolate* isolate() const { return isolate_; }

    private:
     enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
@@ -854,6 +856,7 @@
     Kind right_kind_;
     Kind result_kind_;
     Maybe<int> fixed_right_arg_;
+    Isolate* isolate_;
   };

   explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Fri Apr 25 07:56:13 2014 UTC
+++ /branches/bleeding_edge/src/type-info.cc    Fri Apr 25 08:40:23 2014 UTC
@@ -255,7 +255,7 @@
   }
   Handle<Code> code = Handle<Code>::cast(object);
   ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
-  BinaryOpIC::State state(code->extra_ic_state());
+  BinaryOpIC::State state(isolate(), code->extra_ic_state());
   ASSERT_EQ(op, state.op());

   *left = state.GetLeftType(zone());
@@ -277,7 +277,7 @@
   if (!object->IsCode()) return Type::None(zone());
   Handle<Code> code = Handle<Code>::cast(object);
   ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
-  BinaryOpIC::State state(code->extra_ic_state());
+  BinaryOpIC::State state(isolate(), code->extra_ic_state());
   return state.GetLeftType(zone());
 }

--
--
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/d/optout.

Reply via email to