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

Side by Side Diff: src/runtime.cc

Issue 7280012: Introduce scopes to keep track of catch blocks at compile time. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update to HEAD. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 10041 matching lines...) Expand 10 before | Expand all | Expand 10 after
10052 locals->set(i * 2, *info.LocalName(i)); 10052 locals->set(i * 2, *info.LocalName(i));
10053 if (it.frame()->is_optimized()) { 10053 if (it.frame()->is_optimized()) {
10054 // Get the value from the deoptimized frame. 10054 // Get the value from the deoptimized frame.
10055 locals->set(i * 2 + 1, 10055 locals->set(i * 2 + 1,
10056 deoptimized_frame->GetExpression(i)); 10056 deoptimized_frame->GetExpression(i));
10057 } else { 10057 } else {
10058 // Get the value from the stack. 10058 // Get the value from the stack.
10059 locals->set(i * 2 + 1, it.frame()->GetExpression(i)); 10059 locals->set(i * 2 + 1, it.frame()->GetExpression(i));
10060 } 10060 }
10061 } 10061 }
10062 // Get the context containing declarations. 10062 if (i < info.NumberOfLocals()) {
10063 Handle<Context> context( 10063 // Get the context containing declarations.
10064 Context::cast(it.frame()->context())->declaration_context()); 10064 Handle<Context> context(
10065 for (; i < info.NumberOfLocals(); ++i) { 10065 Context::cast(it.frame()->context())->declaration_context());
10066 Handle<String> name = info.LocalName(i); 10066 for (; i < info.NumberOfLocals(); ++i) {
10067 locals->set(i * 2, *name); 10067 Handle<String> name = info.LocalName(i);
10068 locals->set(i * 2 + 1, 10068 locals->set(i * 2, *name);
10069 context->get(scope_info->ContextSlotIndex(*name, NULL))); 10069 locals->set(i * 2 + 1,
10070 context->get(scope_info->ContextSlotIndex(*name, NULL)));
10071 }
10070 } 10072 }
10071 10073
10072 // Check whether this frame is positioned at return. If not top 10074 // Check whether this frame is positioned at return. If not top
10073 // frame or if the frame is optimized it cannot be at a return. 10075 // frame or if the frame is optimized it cannot be at a return.
10074 bool at_return = false; 10076 bool at_return = false;
10075 if (!it.frame()->is_optimized() && index == 0) { 10077 if (!it.frame()->is_optimized() && index == 0) {
10076 at_return = isolate->debug()->IsBreakAtReturn(it.frame()); 10078 at_return = isolate->debug()->IsBreakAtReturn(it.frame());
10077 } 10079 }
10078 10080
10079 // If positioned just before return find the value to be returned and add it 10081 // If positioned just before return find the value to be returned and add it
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
10281 isolate, 10283 isolate,
10282 SetProperty(local_scope, 10284 SetProperty(local_scope,
10283 scope_info.parameter_name(i), 10285 scope_info.parameter_name(i),
10284 Handle<Object>(frame->GetParameter(i), isolate), 10286 Handle<Object>(frame->GetParameter(i), isolate),
10285 NONE, 10287 NONE,
10286 kNonStrictMode), 10288 kNonStrictMode),
10287 Handle<JSObject>()); 10289 Handle<JSObject>());
10288 } 10290 }
10289 10291
10290 // Second fill all stack locals. 10292 // Second fill all stack locals.
10291 for (int i = 0; i < scope_info.number_of_stack_slots(); i++) { 10293 for (int i = 0; i < scope_info.number_of_stack_slots(); ++i) {
10292 RETURN_IF_EMPTY_HANDLE_VALUE( 10294 RETURN_IF_EMPTY_HANDLE_VALUE(
10293 isolate, 10295 isolate,
10294 SetProperty(local_scope, 10296 SetProperty(local_scope,
10295 scope_info.stack_slot_name(i), 10297 scope_info.stack_slot_name(i),
10296 Handle<Object>(frame->GetExpression(i), isolate), 10298 Handle<Object>(frame->GetExpression(i), isolate),
10297 NONE, 10299 NONE,
10298 kNonStrictMode), 10300 kNonStrictMode),
10299 Handle<JSObject>()); 10301 Handle<JSObject>());
10300 } 10302 }
10301 10303
10302 // Third fill all context locals. 10304 if (scope_info.number_of_context_slots() > Context::MIN_CONTEXT_SLOTS) {
10303 Handle<Context> frame_context(Context::cast(frame->context())); 10305 // Third fill all context locals.
10304 Handle<Context> function_context(frame_context->declaration_context()); 10306 Handle<Context> frame_context(Context::cast(frame->context()));
10305 if (!CopyContextLocalsToScopeObject(isolate, 10307 Handle<Context> function_context(frame_context->declaration_context());
10306 serialized_scope_info, scope_info, 10308 if (!CopyContextLocalsToScopeObject(isolate,
10307 function_context, local_scope)) { 10309 serialized_scope_info, scope_info,
10308 return Handle<JSObject>(); 10310 function_context, local_scope)) {
10309 } 10311 return Handle<JSObject>();
10312 }
10310 10313
10311 // Finally copy any properties from the function context extension. This will 10314 // Finally copy any properties from the function context extension. This wil l
Kevin Millikin (Chromium) 2011/06/30 09:28:45 Long line already fixed.
10312 // be variables introduced by eval. 10315 // be variables introduced by eval.
10313 if (function_context->closure() == *function) { 10316 if (function_context->closure() == *function) {
10314 if (function_context->has_extension() && 10317 if (function_context->has_extension() &&
10315 !function_context->IsGlobalContext()) { 10318 !function_context->IsGlobalContext()) {
10316 Handle<JSObject> ext(JSObject::cast(function_context->extension())); 10319 Handle<JSObject> ext(JSObject::cast(function_context->extension()));
10317 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS); 10320 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS);
10318 for (int i = 0; i < keys->length(); i++) { 10321 for (int i = 0; i < keys->length(); i++) {
10319 // Names of variables introduced by eval are strings. 10322 // Names of variables introduced by eval are strings.
10320 ASSERT(keys->get(i)->IsString()); 10323 ASSERT(keys->get(i)->IsString());
10321 Handle<String> key(String::cast(keys->get(i))); 10324 Handle<String> key(String::cast(keys->get(i)));
10322 RETURN_IF_EMPTY_HANDLE_VALUE( 10325 RETURN_IF_EMPTY_HANDLE_VALUE(
10323 isolate, 10326 isolate,
10324 SetProperty(local_scope, 10327 SetProperty(local_scope,
10325 key, 10328 key,
10326 GetProperty(ext, key), 10329 GetProperty(ext, key),
10327 NONE, 10330 NONE,
10328 kNonStrictMode), 10331 kNonStrictMode),
10329 Handle<JSObject>()); 10332 Handle<JSObject>());
10333 }
10330 } 10334 }
10331 } 10335 }
10332 } 10336 }
10337
10333 return local_scope; 10338 return local_scope;
10334 } 10339 }
10335 10340
10336 10341
10337 // Create a plain JSObject which materializes the closure content for the 10342 // Create a plain JSObject which materializes the closure content for the
10338 // context. 10343 // context.
10339 static Handle<JSObject> MaterializeClosure(Isolate* isolate, 10344 static Handle<JSObject> MaterializeClosure(Isolate* isolate,
10340 Handle<Context> context) { 10345 Handle<Context> context) {
10341 ASSERT(context->IsFunctionContext()); 10346 ASSERT(context->IsFunctionContext());
10342 10347
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
12549 } else { 12554 } else {
12550 // Handle last resort GC and make sure to allow future allocations 12555 // Handle last resort GC and make sure to allow future allocations
12551 // to grow the heap without causing GCs (if possible). 12556 // to grow the heap without causing GCs (if possible).
12552 isolate->counters()->gc_last_resort_from_js()->Increment(); 12557 isolate->counters()->gc_last_resort_from_js()->Increment();
12553 isolate->heap()->CollectAllGarbage(false); 12558 isolate->heap()->CollectAllGarbage(false);
12554 } 12559 }
12555 } 12560 }
12556 12561
12557 12562
12558 } } // namespace v8::internal 12563 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698