Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: src/runtime.cc

Issue 20680002: Rebase of partial ia32 implementation of optimized try/catch (started by Kevin Millikin, continued … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix detection of CATCH frames (fixes debuger exception reporting anf breaks another assertion...). Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698