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

Side by Side Diff: src/runtime.cc

Issue 7395030: Correctly mark functions from our natives files during compilation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.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 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 12256 matching lines...) Expand 10 before | Expand all | Expand 10 after
12267 return *result; 12267 return *result;
12268 } 12268 }
12269 12269
12270 12270
12271 // Determines whether the given stack frame should be displayed in 12271 // Determines whether the given stack frame should be displayed in
12272 // a stack trace. The caller is the error constructor that asked 12272 // a stack trace. The caller is the error constructor that asked
12273 // for the stack trace to be collected. The first time a construct 12273 // for the stack trace to be collected. The first time a construct
12274 // call to this function is encountered it is skipped. The seen_caller 12274 // call to this function is encountered it is skipped. The seen_caller
12275 // in/out parameter is used to remember if the caller has been seen 12275 // in/out parameter is used to remember if the caller has been seen
12276 // yet. 12276 // yet.
12277 static bool ShowFrameInStackTrace(StackFrame* raw_frame, Object* caller, 12277 static bool ShowFrameInStackTrace(StackFrame* raw_frame,
12278 bool* seen_caller) { 12278 Object* caller,
12279 bool* seen_caller) {
12279 // Only display JS frames. 12280 // Only display JS frames.
12280 if (!raw_frame->is_java_script()) 12281 if (!raw_frame->is_java_script())
12281 return false; 12282 return false;
12282 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); 12283 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame);
12283 Object* raw_fun = frame->function(); 12284 Object* raw_fun = frame->function();
12284 // Not sure when this can happen but skip it just in case. 12285 // Not sure when this can happen but skip it just in case.
12285 if (!raw_fun->IsJSFunction()) 12286 if (!raw_fun->IsJSFunction())
12286 return false; 12287 return false;
12287 if ((raw_fun == caller) && !(*seen_caller)) { 12288 if ((raw_fun == caller) && !(*seen_caller)) {
12288 *seen_caller = true; 12289 *seen_caller = true;
12289 return false; 12290 return false;
12290 } 12291 }
12291 // Skip all frames until we've seen the caller. Also, skip the most 12292 // Skip all frames until we've seen the caller.
12292 // obvious builtin calls. Some builtin calls (such as Number.ADD 12293 if (!(*seen_caller)) return false;
12293 // which is invoked using 'call') are very difficult to recognize 12294 // Also, skip the most obvious builtin calls. We recognize builtins
12294 // so we're leaving them in for now. 12295 // as (1) functions called with the builtins object as the receiver and
12295 return *seen_caller && !frame->receiver()->IsJSBuiltinsObject(); 12296 // as (2) functions from native scripts called with undefined as the
12297 // receiver (direct calls to helper functions in the builtins
12298 // code). Some builtin calls (such as Number.ADD which is invoked
12299 // using 'call') are very difficult to recognize so we're leaving
12300 // them in for now.
12301 if (frame->receiver()->IsJSBuiltinsObject()) {
12302 return false;
12303 }
12304 JSFunction* fun = JSFunction::cast(raw_fun);
12305 Object* raw_script = fun->shared()->script();
12306 if (frame->receiver()->IsUndefined() && raw_script->IsScript()) {
12307 int script_type = Script::cast(raw_script)->type()->value();
12308 return script_type != Script::TYPE_NATIVE;
12309 }
12310 return true;
12296 } 12311 }
12297 12312
12298 12313
12299 // Collect the raw data for a stack trace. Returns an array of 4 12314 // Collect the raw data for a stack trace. Returns an array of 4
12300 // element segments each containing a receiver, function, code and 12315 // element segments each containing a receiver, function, code and
12301 // native code offset. 12316 // native code offset.
12302 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) { 12317 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) {
12303 ASSERT_EQ(args.length(), 2); 12318 ASSERT_EQ(args.length(), 2);
12304 Handle<Object> caller = args.at<Object>(0); 12319 Handle<Object> caller = args.at<Object>(0);
12305 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[1]); 12320 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[1]);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
12670 } else { 12685 } else {
12671 // Handle last resort GC and make sure to allow future allocations 12686 // Handle last resort GC and make sure to allow future allocations
12672 // to grow the heap without causing GCs (if possible). 12687 // to grow the heap without causing GCs (if possible).
12673 isolate->counters()->gc_last_resort_from_js()->Increment(); 12688 isolate->counters()->gc_last_resort_from_js()->Increment();
12674 isolate->heap()->CollectAllGarbage(false); 12689 isolate->heap()->CollectAllGarbage(false);
12675 } 12690 }
12676 } 12691 }
12677 12692
12678 12693
12679 } } // namespace v8::internal 12694 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698