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

Side by Side Diff: src/isolate.cc

Issue 148153010: Synchronize with r15701. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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
« no previous file with comments | « src/icu_util.cc ('k') | src/json-stringifier.h » ('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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // for the stack trace to be collected. The first time a construct 617 // for the stack trace to be collected. The first time a construct
618 // call to this function is encountered it is skipped. The seen_caller 618 // call to this function is encountered it is skipped. The seen_caller
619 // in/out parameter is used to remember if the caller has been seen 619 // in/out parameter is used to remember if the caller has been seen
620 // yet. 620 // yet.
621 static bool IsVisibleInStackTrace(StackFrame* raw_frame, 621 static bool IsVisibleInStackTrace(StackFrame* raw_frame,
622 Object* caller, 622 Object* caller,
623 bool* seen_caller) { 623 bool* seen_caller) {
624 // Only display JS frames. 624 // Only display JS frames.
625 if (!raw_frame->is_java_script()) return false; 625 if (!raw_frame->is_java_script()) return false;
626 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); 626 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame);
627 Object* raw_fun = frame->function(); 627 JSFunction* fun = frame->function();
628 // Not sure when this can happen but skip it just in case. 628 if ((fun == caller) && !(*seen_caller)) {
629 if (!raw_fun->IsJSFunction()) return false;
630 if ((raw_fun == caller) && !(*seen_caller)) {
631 *seen_caller = true; 629 *seen_caller = true;
632 return false; 630 return false;
633 } 631 }
634 // Skip all frames until we've seen the caller. 632 // Skip all frames until we've seen the caller.
635 if (!(*seen_caller)) return false; 633 if (!(*seen_caller)) return false;
636 // Also, skip non-visible built-in functions and any call with the builtins 634 // Also, skip non-visible built-in functions and any call with the builtins
637 // object as receiver, so as to not reveal either the builtins object or 635 // object as receiver, so as to not reveal either the builtins object or
638 // an internal function. 636 // an internal function.
639 // The --builtins-in-stack-traces command line flag allows including 637 // The --builtins-in-stack-traces command line flag allows including
640 // internal call sites in the stack trace for debugging purposes. 638 // internal call sites in the stack trace for debugging purposes.
641 if (!FLAG_builtins_in_stack_traces) { 639 if (!FLAG_builtins_in_stack_traces) {
642 JSFunction* fun = JSFunction::cast(raw_fun);
643 if (frame->receiver()->IsJSBuiltinsObject() || 640 if (frame->receiver()->IsJSBuiltinsObject() ||
644 (fun->IsBuiltin() && !fun->shared()->native())) { 641 (fun->IsBuiltin() && !fun->shared()->native())) {
645 return false; 642 return false;
646 } 643 }
647 } 644 }
648 return true; 645 return true;
649 } 646 }
650 647
651 648
652 Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object, 649 Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 1193
1197 void Isolate::PrintCurrentStackTrace(FILE* out) { 1194 void Isolate::PrintCurrentStackTrace(FILE* out) {
1198 StackTraceFrameIterator it(this); 1195 StackTraceFrameIterator it(this);
1199 while (!it.done()) { 1196 while (!it.done()) {
1200 HandleScope scope(this); 1197 HandleScope scope(this);
1201 // Find code position if recorded in relocation info. 1198 // Find code position if recorded in relocation info.
1202 JavaScriptFrame* frame = it.frame(); 1199 JavaScriptFrame* frame = it.frame();
1203 int pos = frame->LookupCode()->SourcePosition(frame->pc()); 1200 int pos = frame->LookupCode()->SourcePosition(frame->pc());
1204 Handle<Object> pos_obj(Smi::FromInt(pos), this); 1201 Handle<Object> pos_obj(Smi::FromInt(pos), this);
1205 // Fetch function and receiver. 1202 // Fetch function and receiver.
1206 Handle<JSFunction> fun(JSFunction::cast(frame->function())); 1203 Handle<JSFunction> fun(frame->function());
1207 Handle<Object> recv(frame->receiver(), this); 1204 Handle<Object> recv(frame->receiver(), this);
1208 // Advance to the next JavaScript frame and determine if the 1205 // Advance to the next JavaScript frame and determine if the
1209 // current frame is the top-level frame. 1206 // current frame is the top-level frame.
1210 it.Advance(); 1207 it.Advance();
1211 Handle<Object> is_top_level = it.done() 1208 Handle<Object> is_top_level = it.done()
1212 ? factory()->true_value() 1209 ? factory()->true_value()
1213 : factory()->false_value(); 1210 : factory()->false_value();
1214 // Generate and print stack trace line. 1211 // Generate and print stack trace line.
1215 Handle<String> line = 1212 Handle<String> line =
1216 Execution::GetStackTraceLine(recv, fun, pos_obj, is_top_level); 1213 Execution::GetStackTraceLine(recv, fun, pos_obj, is_top_level);
1217 if (line->length() > 0) { 1214 if (line->length() > 0) {
1218 line->PrintOn(out); 1215 line->PrintOn(out);
1219 PrintF(out, "\n"); 1216 PrintF(out, "\n");
1220 } 1217 }
1221 } 1218 }
1222 } 1219 }
1223 1220
1224 1221
1225 void Isolate::ComputeLocation(MessageLocation* target) { 1222 void Isolate::ComputeLocation(MessageLocation* target) {
1226 *target = MessageLocation(Handle<Script>(heap_.empty_script()), -1, -1); 1223 *target = MessageLocation(Handle<Script>(heap_.empty_script()), -1, -1);
1227 StackTraceFrameIterator it(this); 1224 StackTraceFrameIterator it(this);
1228 if (!it.done()) { 1225 if (!it.done()) {
1229 JavaScriptFrame* frame = it.frame(); 1226 JavaScriptFrame* frame = it.frame();
1230 JSFunction* fun = JSFunction::cast(frame->function()); 1227 JSFunction* fun = frame->function();
1231 Object* script = fun->shared()->script(); 1228 Object* script = fun->shared()->script();
1232 if (script->IsScript() && 1229 if (script->IsScript() &&
1233 !(Script::cast(script)->source()->IsUndefined())) { 1230 !(Script::cast(script)->source()->IsUndefined())) {
1234 int pos = frame->LookupCode()->SourcePosition(frame->pc()); 1231 int pos = frame->LookupCode()->SourcePosition(frame->pc());
1235 // Compute the location from the function and the reloc info. 1232 // Compute the location from the function and the reloc info.
1236 Handle<Script> casted_script(Script::cast(script)); 1233 Handle<Script> casted_script(Script::cast(script));
1237 *target = MessageLocation(casted_script, pos, pos + 1); 1234 *target = MessageLocation(casted_script, pos, pos + 1);
1238 } 1235 }
1239 } 1236 }
1240 } 1237 }
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 2510
2514 #ifdef DEBUG 2511 #ifdef DEBUG
2515 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2512 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2516 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2513 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2517 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2514 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2518 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2515 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2519 #undef ISOLATE_FIELD_OFFSET 2516 #undef ISOLATE_FIELD_OFFSET
2520 #endif 2517 #endif
2521 2518
2522 } } // namespace v8::internal 2519 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/icu_util.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698