| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 02a97e24b17156f16e7a407bcbaa30af594356ab..fbbf1985e1cbeebb9d5eb6ed4d5a8eac5a6ee96a 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -2293,11 +2293,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
|
|
|
|
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
|
| + //FIXME(mmassi): ask yangguo if this should be moved, too...
|
| SealHandleScope shs(isolate);
|
| - DisallowHeapAllocation no_allocation;
|
| ASSERT(args.length() == 5);
|
| CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
| CONVERT_ARG_CHECKED(String, source, 1);
|
| + // The no_allocation scope must begin after the above checks because they can
|
| + // throw and the throw can allocate to build the message.
|
| + DisallowHeapAllocation no_allocation;
|
| // 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_string();
|
| @@ -9082,6 +9085,40 @@ 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(
|
| + isolate, deopt_index, Deoptimizer::LAZY);
|
| + //TODO(mmassi): Add a proper "NONE" to RelocInfo.
|
| + patcher.masm()->call(deopt_entry, RelocInfo::NONE32);
|
| +
|
| + // 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);
|
|
|