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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 array->set_elements(elements); 2286 array->set_elements(elements);
2287 array->set_length(Smi::FromInt(elements_count)); 2287 array->set_length(Smi::FromInt(elements_count));
2288 // Write in-object properties after the length of the array. 2288 // Write in-object properties after the length of the array.
2289 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); 2289 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]);
2290 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); 2290 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]);
2291 return array; 2291 return array;
2292 } 2292 }
2293 2293
2294 2294
2295 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { 2295 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
2296 //FIXME(mmassi): ask yangguo if this should be moved, too...
2296 SealHandleScope shs(isolate); 2297 SealHandleScope shs(isolate);
2297 DisallowHeapAllocation no_allocation;
2298 ASSERT(args.length() == 5); 2298 ASSERT(args.length() == 5);
2299 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); 2299 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
2300 CONVERT_ARG_CHECKED(String, source, 1); 2300 CONVERT_ARG_CHECKED(String, source, 1);
2301 // The no_allocation scope must begin after the above checks because they can
2302 // throw and the throw can allocate to build the message.
2303 DisallowHeapAllocation no_allocation;
2301 // If source is the empty string we set it to "(?:)" instead as 2304 // If source is the empty string we set it to "(?:)" instead as
2302 // suggested by ECMA-262, 5th, section 15.10.4.1. 2305 // suggested by ECMA-262, 5th, section 15.10.4.1.
2303 if (source->length() == 0) source = isolate->heap()->query_colon_string(); 2306 if (source->length() == 0) source = isolate->heap()->query_colon_string();
2304 2307
2305 Object* global = args[2]; 2308 Object* global = args[2];
2306 if (!global->IsTrue()) global = isolate->heap()->false_value(); 2309 if (!global->IsTrue()) global = isolate->heap()->false_value();
2307 2310
2308 Object* ignoreCase = args[3]; 2311 Object* ignoreCase = args[3];
2309 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value(); 2312 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value();
2310 2313
(...skipping 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after
9075 // Setting read only property in strict mode. 9078 // Setting read only property in strict mode.
9076 Handle<Object> error = 9079 Handle<Object> error =
9077 isolate->factory()->NewTypeError( 9080 isolate->factory()->NewTypeError(
9078 "strict_cannot_assign", HandleVector(&name, 1)); 9081 "strict_cannot_assign", HandleVector(&name, 1));
9079 return isolate->Throw(*error); 9082 return isolate->Throw(*error);
9080 } 9083 }
9081 return *value; 9084 return *value;
9082 } 9085 }
9083 9086
9084 9087
9088 // Returns the offset in "code" where the code has been patched, as a SMI.
9089 RUNTIME_FUNCTION(MaybeObject*, Runtime_CatchInOptimizedCode) {
9090 HandleScope scope(isolate);
9091 ASSERT(args.length() == 1);
9092 Code* code = reinterpret_cast<Code*>(args[0]);
9093
9094 // From the safepoint of the call (i.e., the frame's pc) we can get the
9095 // offset of the lazy deoptimization point.
9096 DeoptimizationInputData* deopt_data =
9097 DeoptimizationInputData::cast(code->deoptimization_data());
9098 int deopt_index = isolate->optimized_handler_deopt_index();
9099 ASSERT(deopt_index < deopt_data->DeoptCount());
9100
9101 // Save the code at the lazy deoptimization point off to the side and
9102 // patch the lazy deoptimization point with a call to the lazy deopt stub.
9103 int patch_size = Deoptimizer::patch_size();
9104 Address patch_address =
9105 code->instruction_start() + deopt_data->Pc(deopt_index)->value();
9106 isolate->set_optimized_handler_patch_buffer(patch_address, patch_size);
9107 CodePatcher patcher(patch_address, patch_size);
9108 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
9109 isolate, deopt_index, Deoptimizer::LAZY);
9110 //TODO(mmassi): Add a proper "NONE" to RelocInfo.
9111 patcher.masm()->call(deopt_entry, RelocInfo::NONE32);
9112
9113 // Lazy deoptimization expects to find the code in a linked list.
9114 isolate->deoptimizer_data()->append_deoptimizing_code(code);
9115
9116 int frame_pc_offset = isolate->optimized_handler_frame_pc_offset();
9117 isolate->clear_optimized_handler_frame_pc_offset();
9118 return Smi::FromInt(frame_pc_offset);
9119 }
9120
9121
9085 RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) { 9122 RUNTIME_FUNCTION(MaybeObject*, Runtime_Throw) {
9086 HandleScope scope(isolate); 9123 HandleScope scope(isolate);
9087 ASSERT(args.length() == 1); 9124 ASSERT(args.length() == 1);
9088 9125
9089 return isolate->Throw(args[0]); 9126 return isolate->Throw(args[0]);
9090 } 9127 }
9091 9128
9092 9129
9093 RUNTIME_FUNCTION(MaybeObject*, Runtime_ReThrow) { 9130 RUNTIME_FUNCTION(MaybeObject*, Runtime_ReThrow) {
9094 HandleScope scope(isolate); 9131 HandleScope scope(isolate);
(...skipping 4752 matching lines...) Expand 10 before | Expand all | Expand 10 after
13847 // Handle last resort GC and make sure to allow future allocations 13884 // Handle last resort GC and make sure to allow future allocations
13848 // to grow the heap without causing GCs (if possible). 13885 // to grow the heap without causing GCs (if possible).
13849 isolate->counters()->gc_last_resort_from_js()->Increment(); 13886 isolate->counters()->gc_last_resort_from_js()->Increment();
13850 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13887 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13851 "Runtime::PerformGC"); 13888 "Runtime::PerformGC");
13852 } 13889 }
13853 } 13890 }
13854 13891
13855 13892
13856 } } // namespace v8::internal 13893 } } // namespace v8::internal
OLDNEW
« 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