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

Side by Side Diff: src/runtime.cc

Issue 11377158: Fire 'stack' getter of error objects after GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: use hidden properties to mark oneshot getter Created 8 years 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 12903 matching lines...) Expand 10 before | Expand all | Expand 10 after
12914 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); 12914 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]);
12915 12915
12916 HandleScope scope(isolate); 12916 HandleScope scope(isolate);
12917 // Optionally capture a more detailed stack trace for the message. 12917 // Optionally capture a more detailed stack trace for the message.
12918 isolate->CaptureAndSetDetailedStackTrace(error_object); 12918 isolate->CaptureAndSetDetailedStackTrace(error_object);
12919 // Capture a simple stack trace for the stack property. 12919 // Capture a simple stack trace for the stack property.
12920 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); 12920 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit);
12921 } 12921 }
12922 12922
12923 12923
12924 // Mark a function to recognize when called after GC to format the stack trace.
12925 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkOneShotGetter) {
12926 ASSERT_EQ(args.length(), 1);
12927 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
12928 HandleScope scope(isolate);
12929 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol();
12930 JSObject::SetHiddenProperty(fun, key, key);
12931 return *fun;
12932 }
12933
12934
12924 // Retrieve the raw stack trace collected on stack overflow and delete 12935 // Retrieve the raw stack trace collected on stack overflow and delete
12925 // it since it is used only once to avoid keeping it alive. 12936 // it since it is used only once to avoid keeping it alive.
12926 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) { 12937 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) {
12927 ASSERT_EQ(args.length(), 1); 12938 ASSERT_EQ(args.length(), 1);
12928 CONVERT_ARG_CHECKED(JSObject, error_object, 0); 12939 CONVERT_ARG_CHECKED(JSObject, error_object, 0);
12929 String* key = isolate->heap()->hidden_stack_trace_symbol(); 12940 String* key = isolate->heap()->hidden_stack_trace_symbol();
12930 Object* result = error_object->GetHiddenProperty(key); 12941 Object* result = error_object->GetHiddenProperty(key);
12931 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); 12942 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined());
12932 error_object->DeleteHiddenProperty(key); 12943 error_object->DeleteHiddenProperty(key);
12933 return result; 12944 return result;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
13317 // Handle last resort GC and make sure to allow future allocations 13328 // Handle last resort GC and make sure to allow future allocations
13318 // to grow the heap without causing GCs (if possible). 13329 // to grow the heap without causing GCs (if possible).
13319 isolate->counters()->gc_last_resort_from_js()->Increment(); 13330 isolate->counters()->gc_last_resort_from_js()->Increment();
13320 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13331 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13321 "Runtime::PerformGC"); 13332 "Runtime::PerformGC");
13322 } 13333 }
13323 } 13334 }
13324 13335
13325 13336
13326 } } // namespace v8::internal 13337 } } // namespace v8::internal
OLDNEW
« src/messages.js ('K') | « src/runtime.h ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698