| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 0fbd9c2cc082d2b5de218797909b4aac75257a21..0cf8bc9e19167bd1b4ba802e3b4fe97c7d627eff 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -1850,10 +1850,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
|
|
|
|
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
|
| - AssertNoAllocation no_alloc;
|
| ASSERT(args.length() == 5);
|
| CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
| CONVERT_ARG_CHECKED(String, source, 1);
|
| + // The no_alloc scope must begin after the above checks because they can
|
| + // throw and the throw can allocate to build the message.
|
| + AssertNoAllocation no_alloc;
|
| // If source is the empty string we set it to "(?:)" instead as
|
| // suggested by ECMA-262, 5th, section 15.10.4.1.
|
| if (source->length() == 0) source = isolate->heap()->query_colon_symbol();
|
| @@ -8817,6 +8819,39 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
|
| }
|
|
|
|
|
| +// Returns the offset in "code" where the code has been patched, as a SMI.
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_CatchInOptimizedCode) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 1);
|
| + Code* code = reinterpret_cast<Code*>(args[0]);
|
| +
|
| + // From the safepoint of the call (i.e., the frame's pc) we can get the
|
| + // offset of the lazy deoptimization point.
|
| + DeoptimizationInputData* deopt_data =
|
| + DeoptimizationInputData::cast(code->deoptimization_data());
|
| + int deopt_index = isolate->optimized_handler_deopt_index();
|
| + ASSERT(deopt_index < deopt_data->DeoptCount());
|
| +
|
| + // Save the code at the lazy deoptimization point off to the side and
|
| + // patch the lazy deoptimization point with a call to the lazy deopt stub.
|
| + int patch_size = Deoptimizer::patch_size();
|
| + Address patch_address =
|
| + code->instruction_start() + deopt_data->Pc(deopt_index)->value();
|
| + isolate->set_optimized_handler_patch_buffer(patch_address, patch_size);
|
| + CodePatcher patcher(patch_address, patch_size);
|
| + Address deopt_entry =
|
| + Deoptimizer::GetDeoptimizationEntry(deopt_index, Deoptimizer::LAZY);
|
| + patcher.masm()->call(deopt_entry, RelocInfo::NONE);
|
| +
|
| + // Lazy deoptimization expects to find the code in a linked list.
|
| + isolate->deoptimizer_data()->append_deoptimizing_code(code);
|
| +
|
| + int frame_pc_offset = isolate->optimized_handler_frame_pc_offset();
|
| + isolate->clear_optimized_handler_frame_pc_offset();
|
| + return Smi::FromInt(frame_pc_offset);
|
| +}
|
| +
|
| +
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) {
|
| HandleScope scope(isolate);
|
| ASSERT(args.length() == 1);
|
|
|