| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 56558e0ab5dfb33400523f2a7566da72481ab90b..2c0cab0ce9f9a4aa5ed4be8cd60544d210d012ac 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -6551,8 +6551,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
|
| int part_count = indices.length();
|
|
|
| Handle<JSArray> result = isolate->factory()->NewJSArray(part_count);
|
| - MaybeObject* maybe_result = result->EnsureCanContainHeapObjectElements();
|
| - if (maybe_result->IsFailure()) return maybe_result;
|
| + JSObject::EnsureCanContainHeapObjectElements(result);
|
| result->set_length(Smi::FromInt(part_count));
|
|
|
| ASSERT(result->HasFastObjectElements());
|
| @@ -6945,21 +6944,20 @@ static inline void StringBuilderConcatHelper(String* special,
|
|
|
|
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
|
| - SealHandleScope shs(isolate);
|
| + HandleScope scope(isolate);
|
| ASSERT(args.length() == 3);
|
| - CONVERT_ARG_CHECKED(JSArray, array, 0);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
|
| if (!args[1]->IsSmi()) {
|
| isolate->context()->mark_out_of_memory();
|
| return Failure::OutOfMemoryException(0x14);
|
| }
|
| int array_length = args.smi_at(1);
|
| - CONVERT_ARG_CHECKED(String, special, 2);
|
| + CONVERT_ARG_HANDLE_CHECKED(String, special, 2);
|
|
|
| // This assumption is used by the slice encoding in one or two smis.
|
| ASSERT(Smi::kMaxValue >= String::kMaxLength);
|
|
|
| - MaybeObject* maybe_result = array->EnsureCanContainHeapObjectElements();
|
| - if (maybe_result->IsFailure()) return maybe_result;
|
| + JSObject::EnsureCanContainHeapObjectElements(array);
|
|
|
| int special_length = special->length();
|
| if (!array->HasFastObjectElements()) {
|
| @@ -7041,7 +7039,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
|
| if (!maybe_object->ToObject(&object)) return maybe_object;
|
| }
|
| SeqOneByteString* answer = SeqOneByteString::cast(object);
|
| - StringBuilderConcatHelper(special,
|
| + StringBuilderConcatHelper(*special,
|
| answer->GetChars(),
|
| fixed_array,
|
| array_length);
|
| @@ -7052,7 +7050,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) {
|
| if (!maybe_object->ToObject(&object)) return maybe_object;
|
| }
|
| SeqTwoByteString* answer = SeqTwoByteString::cast(object);
|
| - StringBuilderConcatHelper(special,
|
| + StringBuilderConcatHelper(*special,
|
| answer->GetChars(),
|
| fixed_array,
|
| array_length);
|
| @@ -8318,9 +8316,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) {
|
| return function->code();
|
| }
|
| function->shared()->code()->set_profiler_ticks(0);
|
| - if (JSFunction::CompileOptimized(function,
|
| - BailoutId::None(),
|
| - CLEAR_EXCEPTION)) {
|
| + if (JSFunction::CompileOptimized(function, CLEAR_EXCEPTION)) {
|
| return function->code();
|
| }
|
| if (FLAG_trace_opt) {
|
| @@ -8415,6 +8411,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {
|
|
|
| JavaScriptFrame* frame = it.frame();
|
| RUNTIME_ASSERT(frame->function()->IsJSFunction());
|
| + ASSERT(frame->function() == *function);
|
|
|
| // Avoid doing too much work when running with --always-opt and keep
|
| // the optimized code around.
|
| @@ -8592,22 +8589,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
|
| // We're not prepared to handle a function with arguments object.
|
| ASSERT(!function->shared()->uses_arguments());
|
|
|
| - // If the optimization attempt succeeded, return the AST id tagged as a
|
| - // smi. This tells the builtin that we need to translate the unoptimized
|
| - // frame to an optimized one.
|
| - BailoutId ast_id =
|
| + // If the optimization attempt succeeds, return the code object which
|
| + // the unoptimized code can jump into.
|
| + Handle<Code> code =
|
| (FLAG_concurrent_recompilation && FLAG_concurrent_osr)
|
| ? Compiler::CompileForConcurrentOSR(function)
|
| : Compiler::CompileForOnStackReplacement(function);
|
| - if (!ast_id.IsNone()) {
|
| - ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION);
|
| - return Smi::FromInt(ast_id.ToInt());
|
| + if (!code.is_null()) {
|
| +#if DEBUG
|
| + ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION);
|
| + DeoptimizationInputData* data =
|
| + DeoptimizationInputData::cast(code->deoptimization_data());
|
| + ASSERT(!BailoutId(data->OsrAstId()->value()).IsNone());
|
| +#endif
|
| + // TODO(titzer): this is a massive hack to make the deopt counts
|
| + // match. Fix heuristics for reenabling optimizations!
|
| + function->shared()->increment_deopt_count();
|
| + return *code;
|
| } else {
|
| if (function->IsMarkedForLazyRecompilation() ||
|
| function->IsMarkedForConcurrentRecompilation()) {
|
| function->ReplaceCode(function->shared()->code());
|
| }
|
| - return Smi::FromInt(-1);
|
| + return NULL;
|
| }
|
| }
|
|
|
| @@ -9411,9 +9415,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateParseString) {
|
|
|
| CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1);
|
|
|
| - MaybeObject* maybe_result_array =
|
| - output->EnsureCanContainHeapObjectElements();
|
| - if (maybe_result_array->IsFailure()) return maybe_result_array;
|
| + JSObject::EnsureCanContainHeapObjectElements(output);
|
| RUNTIME_ASSERT(output->HasFastObjectElements());
|
|
|
| DisallowHeapAllocation no_gc;
|
|
|