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

Side by Side Diff: src/runtime.cc

Issue 11880018: Reland r13188, r13194, r13256 (Deferred formatting of error stack trace during GC). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 7 years, 11 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') | test/cctest/test-decls.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 13201 matching lines...) Expand 10 before | Expand all | Expand 10 after
13212 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); 13212 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]);
13213 13213
13214 HandleScope scope(isolate); 13214 HandleScope scope(isolate);
13215 // Optionally capture a more detailed stack trace for the message. 13215 // Optionally capture a more detailed stack trace for the message.
13216 isolate->CaptureAndSetDetailedStackTrace(error_object); 13216 isolate->CaptureAndSetDetailedStackTrace(error_object);
13217 // Capture a simple stack trace for the stack property. 13217 // Capture a simple stack trace for the stack property.
13218 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); 13218 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit);
13219 } 13219 }
13220 13220
13221 13221
13222 // Retrieve the raw stack trace collected on stack overflow and delete 13222 // Mark a function to recognize when called after GC to format the stack trace.
13223 // it since it is used only once to avoid keeping it alive. 13223 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkOneShotGetter) {
13224 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) { 13224 ASSERT_EQ(args.length(), 1);
13225 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
13226 HandleScope scope(isolate);
13227 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol();
13228 JSObject::SetHiddenProperty(fun, key, key);
13229 return *fun;
13230 }
13231
13232
13233 // Retrieve the stack trace. This could be the raw stack trace collected
13234 // on stack overflow or the already formatted stack trace string.
13235 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedStackTrace) {
13236 HandleScope scope(isolate);
13225 ASSERT_EQ(args.length(), 1); 13237 ASSERT_EQ(args.length(), 1);
13226 CONVERT_ARG_CHECKED(JSObject, error_object, 0); 13238 CONVERT_ARG_CHECKED(JSObject, error_object, 0);
13227 String* key = isolate->heap()->hidden_stack_trace_symbol(); 13239 String* key = isolate->heap()->hidden_stack_trace_symbol();
13228 Object* result = error_object->GetHiddenProperty(key); 13240 Object* result = error_object->GetHiddenProperty(key);
13229 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); 13241 RUNTIME_ASSERT(result->IsJSArray() ||
13230 error_object->DeleteHiddenProperty(key); 13242 result->IsString() ||
13243 result->IsUndefined());
13231 return result; 13244 return result;
13232 } 13245 }
13233 13246
13234 13247
13248 // Set or clear the stack trace attached to an stack overflow error object.
13249 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetOverflowedStackTrace) {
13250 HandleScope scope(isolate);
13251 ASSERT_EQ(args.length(), 2);
13252 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0);
13253 CONVERT_ARG_HANDLE_CHECKED(HeapObject, value, 1);
13254 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol();
13255 if (value->IsUndefined()) {
13256 error_object->DeleteHiddenProperty(*key);
13257 } else {
13258 RUNTIME_ASSERT(value->IsString());
13259 JSObject::SetHiddenProperty(error_object, key, value);
13260 }
13261 return *error_object;
13262 }
13263
13264
13235 // Returns V8 version as a string. 13265 // Returns V8 version as a string.
13236 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { 13266 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) {
13237 ASSERT_EQ(args.length(), 0); 13267 ASSERT_EQ(args.length(), 0);
13238 13268
13239 NoHandleAllocation ha; 13269 NoHandleAllocation ha;
13240 13270
13241 const char* version_string = v8::V8::GetVersion(); 13271 const char* version_string = v8::V8::GetVersion();
13242 13272
13243 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), 13273 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string),
13244 NOT_TENURED); 13274 NOT_TENURED);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
13643 // Handle last resort GC and make sure to allow future allocations 13673 // Handle last resort GC and make sure to allow future allocations
13644 // to grow the heap without causing GCs (if possible). 13674 // to grow the heap without causing GCs (if possible).
13645 isolate->counters()->gc_last_resort_from_js()->Increment(); 13675 isolate->counters()->gc_last_resort_from_js()->Increment();
13646 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13676 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13647 "Runtime::PerformGC"); 13677 "Runtime::PerformGC");
13648 } 13678 }
13649 } 13679 }
13650 13680
13651 13681
13652 } } // namespace v8::internal 13682 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698