Revision: 20741
Author:   [email protected]
Date:     Tue Apr 15 00:04:44 2014 UTC
Log:      Version 3.26.14 (based on bleeding_edge revision r20713)

Performance and stability improvements on all platforms.
http://code.google.com/p/v8/source/detail?r=20741

Modified:
 /trunk/ChangeLog
 /trunk/include/v8.h
 /trunk/src/api.cc
 /trunk/src/factory.cc
 /trunk/src/factory.h
 /trunk/src/json-stringifier.h
 /trunk/src/messages.js
 /trunk/src/objects-inl.h
 /trunk/src/objects.cc
 /trunk/src/objects.h
 /trunk/src/parser.cc
 /trunk/src/parser.h
 /trunk/src/preparse-data.cc
 /trunk/src/preparse-data.h
 /trunk/src/preparser.cc
 /trunk/src/preparser.h
 /trunk/src/runtime.cc
 /trunk/src/transitions.cc
 /trunk/src/version.cc
 /trunk/test/cctest/test-api.cc
 /trunk/test/cctest/test-heap.cc
 /trunk/tools/push-to-trunk/releases.py
 /trunk/tools/push-to-trunk/test_scripts.py

=======================================
--- /trunk/ChangeLog    Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/ChangeLog    Tue Apr 15 00:04:44 2014 UTC
@@ -1,3 +1,8 @@
+2014-04-15: Version 3.26.14
+
+        Performance and stability improvements on all platforms.
+
+
 2014-04-14: Version 3.26.13

         Make maps in monomorphic IC stubs weak (issue 2073).
=======================================
--- /trunk/include/v8.h Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/include/v8.h Tue Apr 15 00:04:44 2014 UTC
@@ -3893,11 +3893,6 @@
   void ConfigureDefaults(uint64_t physical_memory,
                          uint64_t virtual_memory_limit,
                          uint32_t number_of_processors);
-  // Deprecated.
-  void ConfigureDefaults(uint64_t physical_memory,
-                         uint32_t number_of_processors) {
-    ConfigureDefaults(physical_memory, 0, number_of_processors);
-  }

   int max_young_space_size() const { return max_young_space_size_; }
void set_max_young_space_size(int value) { max_young_space_size_ = value; }
=======================================
--- /trunk/src/api.cc   Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/api.cc   Tue Apr 15 00:04:44 2014 UTC
@@ -1694,40 +1694,44 @@
     CompileOptions options) {
   i::ScriptData* script_data_impl = NULL;
   i::CachedDataMode cached_data_mode = i::NO_CACHED_DATA;
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
+  ON_BAILOUT(isolate, "v8::ScriptCompiler::CompileUnbound()",
+             return Local<UnboundScript>());
   if (options & kProduceDataToCache) {
     cached_data_mode = i::PRODUCE_CACHED_DATA;
     ASSERT(source->cached_data == NULL);
     if (source->cached_data) {
// Asked to produce cached data even though there is some already -> not - // good. In release mode, try to do the right thing: Just regenerate the
-      // data.
-      delete source->cached_data;
-      source->cached_data = NULL;
+      // good. Fail the compilation.
+      EXCEPTION_PREAMBLE(isolate);
+      i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(
+          "invalid_cached_data", isolate->factory()->NewJSArray(0));
+      isolate->Throw(*result);
+      isolate->ReportPendingMessages();
+      has_pending_exception = true;
+      EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>());
     }
   } else if (source->cached_data) {
+    cached_data_mode = i::CONSUME_CACHED_DATA;
     // ScriptData takes care of aligning, in case the data is not aligned
     // correctly.
     script_data_impl = i::ScriptData::New(
         reinterpret_cast<const char*>(source->cached_data->data),
         source->cached_data->length);
-    // We assert that the pre-data is sane, even though we can actually
-    // handle it if it turns out not to be in release mode.
-    ASSERT(script_data_impl->SanityCheck());
-    if (script_data_impl->SanityCheck()) {
-      cached_data_mode = i::CONSUME_CACHED_DATA;
-    } else {
-      // If the pre-data isn't sane we simply ignore it.
+    // If the cached data is not valid, fail the compilation.
+    if (script_data_impl == NULL || !script_data_impl->SanityCheck()) {
+      EXCEPTION_PREAMBLE(isolate);
+      i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(
+          "invalid_cached_data", isolate->factory()->NewJSArray(0));
+      isolate->Throw(*result);
+      isolate->ReportPendingMessages();
       delete script_data_impl;
-      script_data_impl = NULL;
-      delete source->cached_data;
-      source->cached_data = NULL;
+      has_pending_exception = true;
+      EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>());
     }
   }

   i::Handle<i::String> str = Utils::OpenHandle(*(source->source_string));
-  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
-  ON_BAILOUT(isolate, "v8::ScriptCompiler::CompileUnbound()",
-             return Local<UnboundScript>());
   LOG_API(isolate, "ScriptCompiler::CompileUnbound");
   ENTER_V8(isolate);
   i::SharedFunctionInfo* raw_result = NULL;
@@ -5575,7 +5579,8 @@
   LOG_API(i_isolate, "NumberObject::New");
   ENTER_V8(i_isolate);
   i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value);
-  i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number);
+  i::Handle<i::Object> obj =
+      i::Object::ToObject(i_isolate, number).ToHandleChecked();
   return Utils::ToLocal(obj);
 }

@@ -5598,7 +5603,8 @@
                                ? isolate->heap()->true_value()
                                : isolate->heap()->false_value(),
                                isolate);
-  i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean);
+  i::Handle<i::Object> obj =
+      i::Object::ToObject(isolate, boolean).ToHandleChecked();
   return Utils::ToLocal(obj);
 }

@@ -5617,8 +5623,8 @@
   EnsureInitializedForIsolate(isolate, "v8::StringObject::New()");
   LOG_API(isolate, "StringObject::New");
   ENTER_V8(isolate);
-  i::Handle<i::Object> obj =
-      isolate->factory()->ToObject(Utils::OpenHandle(*value));
+  i::Handle<i::Object> obj = i::Object::ToObject(
+      isolate, Utils::OpenHandle(*value)).ToHandleChecked();
   return Utils::ToLocal(obj);
 }

@@ -5638,8 +5644,8 @@
   EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()");
   LOG_API(i_isolate, "SymbolObject::New");
   ENTER_V8(i_isolate);
-  i::Handle<i::Object> obj =
-      i_isolate->factory()->ToObject(Utils::OpenHandle(*value));
+  i::Handle<i::Object> obj = i::Object::ToObject(
+      i_isolate, Utils::OpenHandle(*value)).ToHandleChecked();
   return Utils::ToLocal(obj);
 }

=======================================
--- /trunk/src/factory.cc       Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/factory.cc       Tue Apr 15 00:04:44 2014 UTC
@@ -1668,17 +1668,6 @@
   fun->set_context(isolate()->context()->native_context());
   return fun;
 }
-
-
-Handle<Object> Factory::ToObject(Handle<Object> object) {
-  CALL_HEAP_FUNCTION(isolate(), object->ToObject(isolate()), Object);
-}
-
-
-Handle<Object> Factory::ToObject(Handle<Object> object,
-                                 Handle<Context> native_context) {
-  CALL_HEAP_FUNCTION(isolate(), object->ToObject(*native_context), Object);
-}


 #ifdef ENABLE_DEBUGGER_SUPPORT
=======================================
--- /trunk/src/factory.h        Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/factory.h        Tue Apr 15 00:04:44 2014 UTC
@@ -423,10 +423,6 @@

   Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info);

-  Handle<Object> ToObject(Handle<Object> object);
-  Handle<Object> ToObject(Handle<Object> object,
-                          Handle<Context> native_context);
-
   // Interface for creating error objects.

   Handle<Object> NewError(const char* maker, const char* message,
=======================================
--- /trunk/src/json-stringifier.h       Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/json-stringifier.h       Tue Apr 15 00:04:44 2014 UTC
@@ -264,7 +264,7 @@
       overflowed_(false) {
   factory_ = isolate_->factory();
   accumulator_store_ = Handle<JSValue>::cast(
-                           factory_->ToObject(factory_->empty_string()));
+ Object::ToObject(isolate, factory_->empty_string()).ToHandleChecked());
   part_length_ = kInitialPartLength;
current_part_ = factory_->NewRawOneByteString(part_length_).ToHandleChecked();
   tojson_string_ = factory_->toJSON_string();
=======================================
--- /trunk/src/messages.js      Thu Apr  3 00:05:17 2014 UTC
+++ /trunk/src/messages.js      Tue Apr 15 00:04:44 2014 UTC
@@ -154,7 +154,8 @@
   array_indexof_not_defined:     ["Array.getIndexOf: Argument undefined"],
object_not_extensible: ["Can't add property ", "%0", ", object is not extensible"],
   illegal_access:                ["Illegal access"],
- invalid_preparser_data: ["Invalid preparser data for function ", "%0"], + invalid_cached_data_function: ["Invalid cached data for function ", "%0"],
+  invalid_cached_data:           ["Invalid cached data"],
strict_mode_with: ["Strict mode code may not include a with statement"], strict_eval_arguments: ["Unexpected eval or arguments in strict mode"], too_many_arguments: ["Too many arguments in function call (only 65535 allowed)"],
=======================================
--- /trunk/src/objects-inl.h    Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/objects-inl.h    Tue Apr 15 00:04:44 2014 UTC
@@ -1074,6 +1074,13 @@
   }
   return Failure::Exception();
 }
+
+
+MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
+                                         Handle<Object> object) {
+  return ToObject(
+ isolate, object, handle(isolate->context()->native_context(), isolate));
+}


 bool Object::HasSpecificClassOf(String* name) {
=======================================
--- /trunk/src/objects.cc       Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/objects.cc       Tue Apr 15 00:04:44 2014 UTC
@@ -60,54 +60,26 @@
 namespace v8 {
 namespace internal {

-
-MUST_USE_RESULT static MaybeObject* CreateJSValue(JSFunction* constructor,
-                                                  Object* value) {
-  Object* result;
-  { MaybeObject* maybe_result =
-        constructor->GetHeap()->AllocateJSObject(constructor);
-    if (!maybe_result->ToObject(&result)) return maybe_result;
+MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
+                                         Handle<Object> object,
+                                         Handle<Context> native_context) {
+  if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object);
+  Handle<JSFunction> constructor;
+  if (object->IsNumber()) {
+    constructor = handle(native_context->number_function(), isolate);
+  } else if (object->IsBoolean()) {
+    constructor = handle(native_context->boolean_function(), isolate);
+  } else if (object->IsString()) {
+    constructor = handle(native_context->string_function(), isolate);
+  } else if (object->IsSymbol()) {
+    constructor = handle(native_context->symbol_function(), isolate);
+  } else {
+    return MaybeHandle<JSReceiver>();
   }
-  JSValue::cast(result)->set_value(value);
+  Handle<JSObject> result = isolate->factory()->NewJSObject(constructor);
+  Handle<JSValue>::cast(result)->set_value(*object);
   return result;
 }
-
-
-MaybeObject* Object::ToObject(Context* native_context) {
-  if (IsNumber()) {
-    return CreateJSValue(native_context->number_function(), this);
-  } else if (IsBoolean()) {
-    return CreateJSValue(native_context->boolean_function(), this);
-  } else if (IsString()) {
-    return CreateJSValue(native_context->string_function(), this);
-  } else if (IsSymbol()) {
-    return CreateJSValue(native_context->symbol_function(), this);
-  }
-  ASSERT(IsJSObject());
-  return this;
-}
-
-
-MaybeObject* Object::ToObject(Isolate* isolate) {
-  if (IsJSReceiver()) {
-    return this;
-  } else if (IsNumber()) {
-    Context* native_context = isolate->context()->native_context();
-    return CreateJSValue(native_context->number_function(), this);
-  } else if (IsBoolean()) {
-    Context* native_context = isolate->context()->native_context();
-    return CreateJSValue(native_context->boolean_function(), this);
-  } else if (IsString()) {
-    Context* native_context = isolate->context()->native_context();
-    return CreateJSValue(native_context->string_function(), this);
-  } else if (IsSymbol()) {
-    Context* native_context = isolate->context()->native_context();
-    return CreateJSValue(native_context->symbol_function(), this);
-  }
-
-  // Throw a type error.
-  return Failure::InternalError();
-}


 bool Object::BooleanValue() {
@@ -9474,11 +9446,16 @@
     }
   }

+ // Note that we never eliminate a transition array, though we might right-trim
+  // such that number_of_transitions() == 0. If this assumption changes,
+  // TransitionArray::CopyInsert() will need to deal with the case that a
+  // transition array disappeared during GC.
   int trim = t->number_of_transitions() - transition_index;
   if (trim > 0) {
     RightTrimFixedArray<Heap::FROM_GC>(heap, t, t->IsSimpleTransition()
         ? trim : trim * TransitionArray::kTransitionSize);
   }
+  ASSERT(HasTransitionArray());
 }


=======================================
--- /trunk/src/objects.h        Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/objects.h        Tue Apr 15 00:04:44 2014 UTC
@@ -1523,7 +1523,11 @@

   // Convert to a JSObject if needed.
   // native_context is used when creating wrapper object.
-  MUST_USE_RESULT MaybeObject* ToObject(Context* native_context);
+  static inline MaybeHandle<JSReceiver> ToObject(Isolate* isolate,
+                                                 Handle<Object> object);
+  static MaybeHandle<JSReceiver> ToObject(Isolate* isolate,
+                                          Handle<Object> object,
+                                          Handle<Context> context);

   // Converts this to a Smi if possible.
   // Failure is returned otherwise.
=======================================
--- /trunk/src/parser.cc        Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/parser.cc        Tue Apr 15 00:04:44 2014 UTC
@@ -227,15 +227,13 @@
 ScriptData* ScriptData::New(const char* data, int length) {
   // The length is obviously invalid.
   if (length % sizeof(unsigned) != 0) {
-    return new ScriptData();
+    return NULL;
   }

   int deserialized_data_length = length / sizeof(unsigned);
   unsigned* deserialized_data;
-  ScriptData* script_data = new ScriptData();
-  script_data->owns_store_ =
-      reinterpret_cast<intptr_t>(data) % sizeof(unsigned) != 0;
-  if (script_data->owns_store_) {
+ bool owns_store = reinterpret_cast<intptr_t>(data) % sizeof(unsigned) != 0;
+  if (owns_store) {
     // Copy the data to align it.
     deserialized_data = i::NewArray<unsigned>(deserialized_data_length);
     i::CopyBytes(reinterpret_cast<char*>(deserialized_data),
@@ -244,9 +242,9 @@
     // If aligned, don't create a copy of the data.
deserialized_data = reinterpret_cast<unsigned*>(const_cast<char*>(data));
   }
-  script_data->store_ =
-      Vector<unsigned>(deserialized_data, deserialized_data_length);
-  return script_data;
+  return new ScriptData(
+      Vector<unsigned>(deserialized_data, deserialized_data_length),
+      owns_store);
 }


@@ -740,9 +738,9 @@
       return parser_->LookupCachedSymbol(symbol_id);
     }
   } else if (parser_->cached_data_mode() == PRODUCE_CACHED_DATA) {
-    if (parser_->log_->ShouldLogSymbols()) {
-      parser_->scanner()->LogSymbol(parser_->log_, parser_->position());
-    }
+ // Parser is never used inside lazy functions (it falls back to PreParser
+    // instead), so we can produce the symbol data unconditionally.
+    parser_->scanner()->LogSymbol(parser_->log_, parser_->position());
   }
   Handle<String> result =
       parser_->scanner()->AllocateInternalizedString(parser_->isolate());
@@ -3138,10 +3136,10 @@
 }


-void Parser::ReportInvalidPreparseData(Handle<String> name, bool* ok) {
+void Parser::ReportInvalidCachedData(Handle<String> name, bool* ok) {
   SmartArrayPointer<char> name_string = name->ToCString(DISALLOW_NULLS);
   const char* element[1] = { name_string.get() };
-  ReportMessage("invalid_preparser_data",
+  ReportMessage("invalid_cached_data_function",
                 Vector<const char*>(element, 1));
   *ok = false;
 }
@@ -3402,7 +3400,7 @@
           if (entry.end_pos() <= function_block_pos) {
             // End position greater than end of stream is safe, and hard
             // to check.
-            ReportInvalidPreparseData(function_name, CHECK_OK);
+            ReportInvalidCachedData(function_name, CHECK_OK);
           }
           scanner()->SeekForward(entry.end_pos() - 1);

@@ -3415,20 +3413,13 @@
           scope_->SetStrictMode(entry.strict_mode());
         } else {
// This case happens when we have preparse data but it doesn't contain
-          // an entry for the function. As a safety net, fall back to eager
- // parsing. It is unclear whether PreParser's laziness analysis can - // produce different results than the Parser's laziness analysis (see - // https://codereview.chromium.org/7565003 ). In this case, we must - // discard all the preparse data, since the symbol data will be wrong.
-          is_lazily_parsed = false;
-          cached_data_mode_ = NO_CACHED_DATA;
+          // an entry for the function. Fail the compilation.
+          ReportInvalidCachedData(function_name, CHECK_OK);
         }
       } else {
         // With no cached data, we partially parse the function, without
         // building an AST. This gathers the data needed to build a lazy
         // function.
-        // FIXME(marja): Now the PreParser doesn't need to log functions /
-        // symbols; only errors -> clean that up.
         SingletonLogger logger;
PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger);
         if (result == PreParser::kPreParseStackOverflow) {
=======================================
--- /trunk/src/parser.h Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/parser.h Tue Apr 15 00:04:44 2014 UTC
@@ -88,9 +88,9 @@
       : store_(store),
         owns_store_(true) { }

-  // Create an empty ScriptData that is guaranteed to not satisfy
-  // a SanityCheck.
-  ScriptData() : owns_store_(false) { }
+  ScriptData(Vector<unsigned> store, bool owns_store)
+      : store_(store),
+        owns_store_(owns_store) { }

// The created ScriptData won't take ownership of the data. If the alignment // is not correct, this will copy the data (and the created ScriptData will
@@ -667,7 +667,7 @@
                                   Handle<String> source);

   // Report syntax error
-  void ReportInvalidPreparseData(Handle<String> name, bool* ok);
+  void ReportInvalidCachedData(Handle<String> name, bool* ok);

   void SetCachedData(ScriptData** data,
                      CachedDataMode cached_data_mode) {
=======================================
--- /trunk/src/preparse-data.cc Wed Apr  2 00:05:15 2014 UTC
+++ /trunk/src/preparse-data.cc Tue Apr 15 00:04:44 2014 UTC
@@ -83,7 +83,6 @@
 #ifdef DEBUG
   prev_start_ = -1;
 #endif
-  should_log_symbols_ = true;
 }


@@ -106,7 +105,6 @@
   STATIC_ASSERT(PreparseDataConstants::kMessageTextPos == 4);
   WriteString(CStrVector(message));
   if (arg_opt != NULL) WriteString(CStrVector(arg_opt));
-  should_log_symbols_ = false;
 }


@@ -120,7 +118,6 @@

 void CompleteParserRecorder::LogOneByteSymbol(int start,
Vector<const uint8_t> literal) {
-  ASSERT(should_log_symbols_);
   int hash = vector_hash(literal);
   LogSymbol(start, hash, true, literal);
 }
@@ -128,7 +125,6 @@

 void CompleteParserRecorder::LogTwoByteSymbol(int start,
Vector<const uint16_t> literal) {
-  ASSERT(should_log_symbols_);
   int hash = vector_hash(literal);
   LogSymbol(start, hash, false, Vector<const byte>::cast(literal));
 }
=======================================
--- /trunk/src/preparse-data.h  Wed Apr  2 00:05:15 2014 UTC
+++ /trunk/src/preparse-data.h  Tue Apr 15 00:04:44 2014 UTC
@@ -39,7 +39,7 @@
 // Abstract interface for preparse data recorder.
 class ParserRecorder {
  public:
-  ParserRecorder() : should_log_symbols_(false) { }
+  ParserRecorder() { }
   virtual ~ParserRecorder() { }

   // Logs the scope and some details of a function literal in the source.
@@ -58,8 +58,6 @@
                           const char* argument_opt,
                           bool is_reference_error) = 0;

-  // Logs a symbol creation of a literal or identifier.
-  bool ShouldLogSymbols() { return should_log_symbols_; }
   // The following functions are only callable on CompleteParserRecorder
   // and are guarded by calls to ShouldLogSymbols.
   virtual void LogOneByteSymbol(int start, Vector<const uint8_t> literal) {
@@ -68,11 +66,6 @@
virtual void LogTwoByteSymbol(int start, Vector<const uint16_t> literal) {
     UNREACHABLE();
   }
-  virtual void PauseRecording() { UNREACHABLE(); }
-  virtual void ResumeRecording() { UNREACHABLE(); }
-
- protected:
-  bool should_log_symbols_;

  private:
   DISALLOW_COPY_AND_ASSIGN(ParserRecorder);
@@ -189,16 +182,6 @@
                           const char* argument_opt,
                           bool is_reference_error_);

-  virtual void PauseRecording() {
-    ASSERT(should_log_symbols_);
-    should_log_symbols_ = false;
-  }
-
-  virtual void ResumeRecording() {
-    ASSERT(!should_log_symbols_);
-    should_log_symbols_ = !has_error();
-  }
-
   virtual void LogOneByteSymbol(int start, Vector<const uint8_t> literal);
   virtual void LogTwoByteSymbol(int start, Vector<const uint16_t> literal);
   Vector<unsigned> ExtractData();
=======================================
--- /trunk/src/preparser.cc     Thu Apr  3 00:05:17 2014 UTC
+++ /trunk/src/preparser.cc     Tue Apr 15 00:04:44 2014 UTC
@@ -88,7 +88,6 @@


 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
-  pre_parser_->LogSymbol();
   if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) {
     return PreParserIdentifier::FutureReserved();
   } else if (scanner->current_token() ==
@@ -109,7 +108,6 @@

 PreParserExpression PreParserTraits::ExpressionFromString(
     int pos, Scanner* scanner, PreParserFactory* factory) {
-  pre_parser_->LogSymbol();
   if (scanner->UnescapedLiteralMatches("use strict", 10)) {
     return PreParserExpression::UseStrictStringLiteral();
   }
@@ -932,10 +930,7 @@

 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) {
   int body_start = position();
-  bool is_logging = log_->ShouldLogSymbols();
-  if (is_logging) log_->PauseRecording();
   ParseSourceElements(Token::RBRACE, ok);
-  if (is_logging) log_->ResumeRecording();
   if (!*ok) return;

   // Position right after terminal '}'.
@@ -966,11 +961,4 @@
 #undef CHECK_OK


-void PreParser::LogSymbol() {
-  if (log_->ShouldLogSymbols()) {
-    scanner()->LogSymbol(log_, position());
-  }
-}
-
-
 } }  // v8::internal
=======================================
--- /trunk/src/preparser.h      Thu Apr  3 00:05:17 2014 UTC
+++ /trunk/src/preparser.h      Tue Apr 15 00:04:44 2014 UTC
@@ -1183,11 +1183,6 @@
       bool* ok);
   void ParseLazyFunctionLiteralBody(bool* ok);

-  // Logs the currently parsed literal as a symbol in the preparser data.
-  void LogSymbol();
-  // Log the currently parsed string literal.
-  Expression GetStringSymbol();
-
   bool CheckInOrOf(bool accept_OF);
 };

=======================================
--- /trunk/src/runtime.cc       Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/runtime.cc       Tue Apr 15 00:04:44 2014 UTC
@@ -655,9 +655,10 @@


 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) {
+  HandleScope scope(isolate);
   ASSERT(args.length() == 1);
-  CONVERT_ARG_CHECKED(Symbol, symbol, 0);
-  return symbol->ToObject(isolate);
+  CONVERT_ARG_HANDLE_CHECKED(Symbol, symbol, 0);
+  return *Object::ToObject(isolate, symbol).ToHandleChecked();
 }


@@ -6849,10 +6850,10 @@


 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStringWrapper) {
-  SealHandleScope shs(isolate);
+  HandleScope scope(isolate);
   ASSERT(args.length() == 1);
-  CONVERT_ARG_CHECKED(String, value, 0);
-  return value->ToObject(isolate);
+  CONVERT_ARG_HANDLE_CHECKED(String, value, 0);
+  return *Object::ToObject(isolate, value).ToHandleChecked();
 }


@@ -8952,16 +8953,16 @@
   if (args[0]->IsJSReceiver()) {
     extension_object = args.at<JSReceiver>(0);
   } else {
-    // Convert the object to a proper JavaScript object.
- Handle<Object> object = isolate->factory()->ToObject(args.at<Object>(0));
-    if (object.is_null()) {
+    // Try to convert the object to a proper JavaScript object.
+    MaybeHandle<JSReceiver> maybe_object =
+        Object::ToObject(isolate, args.at<Object>(0));
+    if (!maybe_object.ToHandle(&extension_object)) {
       Handle<Object> handle = args.at<Object>(0);
       Handle<Object> result =
           isolate->factory()->NewTypeError("with_expression",
                                            HandleVector(&handle, 1));
       return isolate->Throw(*result);
     }
-    extension_object = Handle<JSReceiver>::cast(object);
   }

   Handle<JSFunction> function;
@@ -11366,7 +11367,8 @@
       ASSERT(!receiver->IsNull());
       Context* context = Context::cast(it.frame()->context());
Handle<Context> native_context(Context::cast(context->native_context()));
-      receiver = isolate->factory()->ToObject(receiver, native_context);
+      receiver = Object::ToObject(
+          isolate, receiver, native_context).ToHandleChecked();
     }
   }
   details->set(kFrameDetailsReceiverIndex, *receiver);
=======================================
--- /trunk/src/transitions.cc   Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/src/transitions.cc   Tue Apr 15 00:04:44 2014 UTC
@@ -124,26 +124,11 @@

   Handle<TransitionArray> result = Allocate(map->GetIsolate(), new_size);

- // The map's transition array may have disappeared or grown smaller during - // the allocation above as it was weakly traversed. Trim the result copy if
-  // needed, and recompute variables.
+ // The map's transition array may grown smaller during the allocation above as + // it was weakly traversed, though it is guaranteed not to disappear. Trim the
+  // result copy if needed, and recompute variables.
+  ASSERT(map->HasTransitionArray());
   DisallowHeapAllocation no_gc;
-  if (!map->HasTransitionArray()) {
-    if (flag == SIMPLE_TRANSITION) {
-      ASSERT(result->length() >= kSimpleTransitionSize);
-      result->Shrink(kSimpleTransitionSize);
-      result->set(kSimpleTransitionTarget, *target);
-    } else {
-      ASSERT(result->length() >= ToKeyIndex(1));
-      result->Shrink(ToKeyIndex(1));
-      result->set(kPrototypeTransitionsIndex, Smi::FromInt(0));
-      result->NoIncrementalWriteBarrierSet(0, *name, *target);
-    }
-    result->set_back_pointer_storage(map->GetBackPointer());
-
-    return result;
-  }
-
   TransitionArray* array = map->transitions();
   if (array->number_of_transitions() != number_of_transitions) {
     ASSERT(array->number_of_transitions() < number_of_transitions);
=======================================
--- /trunk/src/version.cc       Mon Apr 14 08:51:53 2014 UTC
+++ /trunk/src/version.cc       Tue Apr 15 00:04:44 2014 UTC
@@ -34,8 +34,8 @@
 // system so their names cannot be changed without changing the scripts.
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     26
-#define BUILD_NUMBER      13
-#define PATCH_LEVEL       1
+#define BUILD_NUMBER      14
+#define PATCH_LEVEL       0
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
=======================================
--- /trunk/test/cctest/test-api.cc      Mon Apr 14 08:51:53 2014 UTC
+++ /trunk/test/cctest/test-api.cc      Tue Apr 15 00:04:44 2014 UTC
@@ -14858,10 +14858,7 @@
   const char* data = "DONT CARE";
   int invalid_size = 3;
   i::ScriptData* sd = i::ScriptData::New(data, invalid_size);
-
-  CHECK_EQ(0, sd->Length());
-
-  delete sd;
+  CHECK_EQ(NULL, sd);
 }


@@ -14911,16 +14908,18 @@
       v8::ScriptCompiler::CompileUnbound(isolate, &source2);

   CHECK(try_catch.HasCaught());
-  String::Utf8Value exception_value(try_catch.Message()->Get());
-  CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
-           *exception_value);
+  {
+    String::Utf8Value exception_value(try_catch.Message()->Get());
+    CHECK_EQ("Uncaught SyntaxError: Invalid cached data for function bar",
+             *exception_value);
+  }

   try_catch.Reset();
   delete sd;

-  // Overwrite function bar's start position with 200.  The function entry
-  // will not be found when searching for it by position and we should fall
-  // back on eager compilation.
+ // Overwrite function bar's start position with 200. The function entry will + // not be found when searching for it by position, and the compilation fails.
+
   // ScriptData does not take ownership of the buffers passed to it.
sd = i::ScriptData::New(reinterpret_cast<const char*>(cd->data), cd->length);
   sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
@@ -14934,7 +14933,34 @@
           reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
   compiled_script =
       v8::ScriptCompiler::CompileUnbound(isolate, &source3);
-  CHECK(!try_catch.HasCaught());
+  CHECK(try_catch.HasCaught());
+  {
+    String::Utf8Value exception_value(try_catch.Message()->Get());
+    CHECK_EQ("Uncaught SyntaxError: Invalid cached data for function bar",
+             *exception_value);
+  }
+  CHECK(compiled_script.IsEmpty());
+  try_catch.Reset();
+  delete sd;
+
+  // Try passing in cached data which is obviously invalid (wrong length).
+ sd = i::ScriptData::New(reinterpret_cast<const char*>(cd->data), cd->length);
+  const char* script4 =
+      "function foo(){ return 8;}\n"
+      "function bar(){ return 6 + 7;}  foo();";
+  v8::ScriptCompiler::Source source4(
+      v8_str(script4),
+      new v8::ScriptCompiler::CachedData(
+          reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length() - 1));
+  compiled_script =
+      v8::ScriptCompiler::CompileUnbound(isolate, &source4);
+  CHECK(try_catch.HasCaught());
+  {
+    String::Utf8Value exception_value(try_catch.Message()->Get());
+    CHECK_EQ("Uncaught SyntaxError: Invalid cached data",
+             *exception_value);
+  }
+  CHECK(compiled_script.IsEmpty());
   delete sd;
 }

=======================================
--- /trunk/test/cctest/test-heap.cc     Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/test/cctest/test-heap.cc     Tue Apr 15 00:04:44 2014 UTC
@@ -2669,6 +2669,145 @@
   CompileRun("%DebugPrint(root);");
   CHECK_EQ(1, transitions_after);
 }
+
+
+#ifdef DEBUG
+static void AddTransitions(int transitions_count) {
+  AlwaysAllocateScope always_allocate(CcTest::i_isolate());
+  for (int i = 0; i < transitions_count; i++) {
+    EmbeddedVector<char, 64> buffer;
+    OS::SNPrintF(buffer, "var o = new Object; o.prop%d = %d;", i, i);
+    CompileRun(buffer.start());
+  }
+}
+
+
+static Handle<JSObject> GetByName(const char* name) {
+  return v8::Utils::OpenHandle(
+      *v8::Handle<v8::Object>::Cast(
+          CcTest::global()->Get(v8_str(name))));
+}
+
+
+static void AddPropertyTo(
+    int gc_count, Handle<JSObject> object, const char* property_name) {
+  Isolate* isolate = CcTest::i_isolate();
+  Factory* factory = isolate->factory();
+  Handle<String> prop_name = factory->InternalizeUtf8String(property_name);
+  Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
+  i::FLAG_gc_interval = gc_count;
+  i::FLAG_gc_global = true;
+  CcTest::heap()->set_allocation_timeout(gc_count);
+  JSReceiver::SetProperty(
+      object, prop_name, twenty_three, NONE, SLOPPY).Check();
+}
+
+
+TEST(TransitionArrayShrinksDuringAllocToZero) {
+  i::FLAG_stress_compaction = false;
+  i::FLAG_allow_natives_syntax = true;
+  CcTest::InitializeVM();
+  v8::HandleScope scope(CcTest::isolate());
+  static const int transitions_count = 10;
+  AddTransitions(transitions_count);
+  CompileRun("var root = new Object;");
+  Handle<JSObject> root = GetByName("root");
+
+  // Count number of live transitions before marking.
+  int transitions_before = CountMapTransitions(root->map());
+  CHECK_EQ(transitions_count, transitions_before);
+
+  // Get rid of o
+  CompileRun("o = new Object;"
+             "root = new Object");
+  root = GetByName("root");
+  AddPropertyTo(2, root, "funny");
+
+ // Count number of live transitions after marking. Note that one transition
+  // is left, because 'o' still holds an instance of one transition target.
+  int transitions_after = CountMapTransitions(
+      Map::cast(root->map()->GetBackPointer()));
+  CHECK_EQ(1, transitions_after);
+}
+
+
+TEST(TransitionArrayShrinksDuringAllocToOne) {
+  i::FLAG_stress_compaction = false;
+  i::FLAG_allow_natives_syntax = true;
+  CcTest::InitializeVM();
+  v8::HandleScope scope(CcTest::isolate());
+  static const int transitions_count = 10;
+  AddTransitions(transitions_count);
+  CompileRun("var root = new Object;");
+  Handle<JSObject> root = GetByName("root");
+
+  // Count number of live transitions before marking.
+  int transitions_before = CountMapTransitions(root->map());
+  CHECK_EQ(transitions_count, transitions_before);
+
+  root = GetByName("root");
+  AddPropertyTo(2, root, "funny");
+
+ // Count number of live transitions after marking. Note that one transition
+  // is left, because 'o' still holds an instance of one transition target.
+  int transitions_after = CountMapTransitions(
+      Map::cast(root->map()->GetBackPointer()));
+  CHECK_EQ(2, transitions_after);
+}
+
+
+TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
+  i::FLAG_stress_compaction = false;
+  i::FLAG_allow_natives_syntax = true;
+  CcTest::InitializeVM();
+  v8::HandleScope scope(CcTest::isolate());
+  static const int transitions_count = 10;
+  AddTransitions(transitions_count);
+  CompileRun("var root = new Object;");
+  Handle<JSObject> root = GetByName("root");
+
+  // Count number of live transitions before marking.
+  int transitions_before = CountMapTransitions(root->map());
+  CHECK_EQ(transitions_count, transitions_before);
+
+  root = GetByName("root");
+  AddPropertyTo(0, root, "prop9");
+
+ // Count number of live transitions after marking. Note that one transition
+  // is left, because 'o' still holds an instance of one transition target.
+  int transitions_after = CountMapTransitions(
+      Map::cast(root->map()->GetBackPointer()));
+  CHECK_EQ(1, transitions_after);
+}
+
+
+TEST(TransitionArraySimpleToFull) {
+  i::FLAG_stress_compaction = false;
+  i::FLAG_allow_natives_syntax = true;
+  CcTest::InitializeVM();
+  v8::HandleScope scope(CcTest::isolate());
+  static const int transitions_count = 1;
+  AddTransitions(transitions_count);
+  CompileRun("var root = new Object;");
+  Handle<JSObject> root = GetByName("root");
+
+  // Count number of live transitions before marking.
+  int transitions_before = CountMapTransitions(root->map());
+  CHECK_EQ(transitions_count, transitions_before);
+
+  CompileRun("o = new Object;"
+             "root = new Object");
+  root = GetByName("root");
+  ASSERT(root->map()->transitions()->IsSimpleTransition());
+  AddPropertyTo(2, root, "happy");
+
+ // Count number of live transitions after marking. Note that one transition
+  // is left, because 'o' still holds an instance of one transition target.
+  int transitions_after = CountMapTransitions(
+      Map::cast(root->map()->GetBackPointer()));
+  CHECK_EQ(1, transitions_after);
+}
+#endif  // DEBUG


 TEST(Regress2143a) {
=======================================
--- /trunk/tools/push-to-trunk/releases.py      Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/tools/push-to-trunk/releases.py      Tue Apr 15 00:04:44 2014 UTC
@@ -39,6 +39,9 @@
 # new format).
ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M)

+# Expression for retrieving the code review link.
+REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M)
+
# Expression with three versions (historical) for extracting the v8 revision
 # from the chromium DEPS file.
 DEPS_RE = re.compile(r'^\s*(?:"v8_revision": "'
@@ -134,8 +137,7 @@
   def GetBleedingEdgeFromPush(self, title):
     return MatchSafe(PUSH_MESSAGE_RE.match(title))

-  def GetMergedPatches(self, git_hash):
-    body = self.GitLog(n=1, format="%B", git_hash=git_hash)
+  def GetMergedPatches(self, body):
     patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
     if not patches:
       patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
@@ -148,16 +150,18 @@
     self.ReadAndPersistVersion()
     base_version = [self["major"], self["minor"], self["build"]]
     version = ".".join(base_version)
+    body = self.GitLog(n=1, format="%B", git_hash=git_hash)

     patches = ""
     if self["patch"] != "0":
       version += ".%s" % self["patch"]
-      patches = self.GetMergedPatches(git_hash)
+      patches = self.GetMergedPatches(body)

     title = self.GitLog(n=1, format="%s", git_hash=git_hash)
+    revision = self.GitSVNFindSVNRev(git_hash)
     return {
       # The SVN revision on the branch.
-      "revision": self.GitSVNFindSVNRev(git_hash),
+      "revision": revision,
       # The SVN revision on bleeding edge (only for newer trunk pushes).
       "bleeding_edge": self.GetBleedingEdgeFromPush(title),
       # The branch name.
@@ -168,6 +172,12 @@
       "patches_merged": patches,
       # Default for easier output formatting.
       "chromium_revision": "",
+ # Link to the CL on code review. Trunk pushes are not uploaded, so this
+      # field will be populated below with the recent roll CL link.
+      "review_link": MatchSafe(REVIEW_LINK_RE.search(body)),
+      # Link to the commit message on google code.
+      "revision_link": ("https://code.google.com/p/v8/source/detail?r=%s";
+                        % revision),
     }, self["patch"]

   def GetReleasesFromBranch(self, branch):
=======================================
--- /trunk/tools/push-to-trunk/test_scripts.py  Mon Apr 14 00:05:03 2014 UTC
+++ /trunk/tools/push-to-trunk/test_scripts.py  Tue Apr 15 00:04:44 2014 UTC
@@ -1187,7 +1187,8 @@
       Git("diff --name-only hash2 hash2^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(3, 1, 1)),
-      Git("log -1 --format=%B hash2", "Version 3.3.1.1 (merged 12)"),
+      Git("log -1 --format=%B hash2",
+          "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"),
       Git("log -1 --format=%s hash2", ""),
       Git("svn find-rev hash2", "234"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1197,6 +1198,7 @@
       Git("diff --name-only hash3 hash3^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash3 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(21, 2)),
+      Git("log -1 --format=%B hash3", ""),
       Git("log -1 --format=%s hash3", ""),
       Git("svn find-rev hash3", "123"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1206,6 +1208,7 @@
       Git("diff --name-only hash6 hash6^", TEST_CONFIG[VERSION_FILE]),
       Git("checkout -f hash6 -- %s" % TEST_CONFIG[VERSION_FILE], "",
           cb=ResetVersion(22, 3)),
+      Git("log -1 --format=%B hash6", ""),
       Git("log -1 --format=%s hash6", ""),
       Git("svn find-rev hash6", "345"),
       Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "",
@@ -1243,11 +1246,17 @@

     expected_json = [
       {"bleeding_edge": "", "patches_merged": "", "version": "3.22.3",
-       "chromium_revision": "4567", "branch": "trunk", "revision": "345"},
+       "chromium_revision": "4567", "branch": "trunk", "revision": "345",
+       "review_link": "",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=345"},
       {"patches_merged": "", "bleeding_edge": "", "version": "3.21.2",
-       "chromium_revision": "", "branch": "3.21", "revision": "123"},
+       "chromium_revision": "", "branch": "3.21", "revision": "123",
+       "review_link": "",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=123"},
       {"patches_merged": "12", "bleeding_edge": "", "version": "3.3.1.1",
-       "chromium_revision": "", "branch": "3.3", "revision": "234"}
+       "chromium_revision": "", "branch": "3.3", "revision": "234",
+       "review_link": "fake.com",
+       "revision_link": "https://code.google.com/p/v8/source/detail?r=234"},
     ]
     self.assertEquals(expected_json, json.loads(FileToText(json_output)))

--
--
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