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

Side by Side Diff: src/runtime.cc

Issue 9310122: When rethrowing an exception, print the stack trace of its original site instead of rethrow site. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 8 years, 10 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 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 13245 matching lines...) Expand 10 before | Expand all | Expand 10 after
13256 } 13256 }
13257 } 13257 }
13258 return true; 13258 return true;
13259 } 13259 }
13260 13260
13261 13261
13262 // Collect the raw data for a stack trace. Returns an array of 4 13262 // Collect the raw data for a stack trace. Returns an array of 4
13263 // element segments each containing a receiver, function, code and 13263 // element segments each containing a receiver, function, code and
13264 // native code offset. 13264 // native code offset.
13265 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) { 13265 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) {
13266 ASSERT_EQ(args.length(), 2); 13266 ASSERT_EQ(args.length(), 3);
13267 Handle<Object> caller = args.at<Object>(0); 13267 CONVERT_ARG_CHECKED(JSObject, error_object, 0);
13268 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[1]); 13268 Handle<Object> caller = args.at<Object>(1);
13269 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]);
13269 13270
13270 HandleScope scope(isolate); 13271 HandleScope scope(isolate);
13271 Factory* factory = isolate->factory(); 13272 Factory* factory = isolate->factory();
13272 13273
13273 limit = Max(limit, 0); // Ensure that limit is not negative. 13274 limit = Max(limit, 0); // Ensure that limit is not negative.
13274 int initial_size = Min(limit, 10); 13275 int initial_size = Min(limit, 10);
13275 Handle<FixedArray> elements = 13276 Handle<FixedArray> elements =
13276 factory->NewFixedArrayWithHoles(initial_size * 4); 13277 factory->NewFixedArrayWithHoles(initial_size * 4);
13277 13278
13278 StackFrameIterator iter(isolate); 13279 StackFrameIterator iter(isolate);
(...skipping 29 matching lines...) Expand all
13308 Handle<Smi> offset(Smi::FromInt(frames[i].offset())); 13309 Handle<Smi> offset(Smi::FromInt(frames[i].offset()));
13309 elements->set(cursor++, *recv); 13310 elements->set(cursor++, *recv);
13310 elements->set(cursor++, *fun); 13311 elements->set(cursor++, *fun);
13311 elements->set(cursor++, *code); 13312 elements->set(cursor++, *code);
13312 elements->set(cursor++, *offset); 13313 elements->set(cursor++, *offset);
13313 } 13314 }
13314 } 13315 }
13315 iter.Advance(); 13316 iter.Advance();
13316 } 13317 }
13317 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); 13318 Handle<JSArray> result = factory->NewJSArrayWithElements(elements);
13319 // Capture and attach a more detailed stack trace if necessary.
13320 isolate->CaptureAndSetCurrentStackTraceFor(error_object);
13318 result->set_length(Smi::FromInt(cursor)); 13321 result->set_length(Smi::FromInt(cursor));
13319 return *result; 13322 return *result;
13320 } 13323 }
13321 13324
13322 13325
13323 // Returns V8 version as a string. 13326 // Returns V8 version as a string.
13324 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { 13327 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) {
13325 ASSERT_EQ(args.length(), 0); 13328 ASSERT_EQ(args.length(), 0);
13326 13329
13327 NoHandleAllocation ha; 13330 NoHandleAllocation ha;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
13653 // Handle last resort GC and make sure to allow future allocations 13656 // Handle last resort GC and make sure to allow future allocations
13654 // to grow the heap without causing GCs (if possible). 13657 // to grow the heap without causing GCs (if possible).
13655 isolate->counters()->gc_last_resort_from_js()->Increment(); 13658 isolate->counters()->gc_last_resort_from_js()->Increment();
13656 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13659 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13657 "Runtime::PerformGC"); 13660 "Runtime::PerformGC");
13658 } 13661 }
13659 } 13662 }
13660 13663
13661 13664
13662 } } // namespace v8::internal 13665 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698