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

Side by Side Diff: src/isolate.cc

Issue 2191293002: Move FormatStackTrace to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add formatting_stack_trace to ISOLATE_INIT_LIST Created 4 years, 4 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
« no previous file with comments | « src/isolate.h ('k') | src/js/messages.js » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 Isolate* isolate_; 425 Isolate* isolate_;
426 426
427 const FrameSkipMode mode_; 427 const FrameSkipMode mode_;
428 const Handle<Object> caller_; 428 const Handle<Object> caller_;
429 bool skip_next_frame_; 429 bool skip_next_frame_;
430 430
431 int sloppy_frames_; 431 int sloppy_frames_;
432 bool encountered_strict_function_; 432 bool encountered_strict_function_;
433 }; 433 };
434 434
435 namespace {
436
437 // TODO(jgruber): Fix all cases in which frames give us a hole value (e.g. the
438 // receiver in RegExp constructor frames.
439 Handle<Object> TheHoleToUndefined(Isolate* isolate, Handle<Object> in) {
440 return (in->IsTheHole(isolate))
441 ? Handle<Object>::cast(isolate->factory()->undefined_value())
442 : in;
443 }
444 }
445
435 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSReceiver> error_object, 446 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSReceiver> error_object,
436 FrameSkipMode mode, 447 FrameSkipMode mode,
437 Handle<Object> caller) { 448 Handle<Object> caller) {
438 DisallowJavascriptExecution no_js(this); 449 DisallowJavascriptExecution no_js(this);
439 450
440 // Get stack trace limit. 451 // Get stack trace limit.
441 Handle<JSObject> error = error_function(); 452 Handle<JSObject> error = error_function();
442 Handle<String> stackTraceLimit = 453 Handle<String> stackTraceLimit =
443 factory()->InternalizeUtf8String("stackTraceLimit"); 454 factory()->InternalizeUtf8String("stackTraceLimit");
444 DCHECK(!stackTraceLimit.is_null()); 455 DCHECK(!stackTraceLimit.is_null());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // Help CallSite::IsConstructor correctly detect hand-written 495 // Help CallSite::IsConstructor correctly detect hand-written
485 // construct stubs. 496 // construct stubs.
486 Code* code = Code::cast(*abstract_code); 497 Code* code = Code::cast(*abstract_code);
487 if (code->is_construct_stub()) { 498 if (code->is_construct_stub()) {
488 recv = handle(heap()->call_site_constructor_symbol(), this); 499 recv = handle(heap()->call_site_constructor_symbol(), this);
489 } 500 }
490 } 501 }
491 Handle<Smi> offset(Smi::FromInt(frames[i].code_offset()), this); 502 Handle<Smi> offset(Smi::FromInt(frames[i].code_offset()), this);
492 503
493 elements = MaybeGrow(this, elements, cursor, cursor + 4); 504 elements = MaybeGrow(this, elements, cursor, cursor + 4);
494 elements->set(cursor++, *recv); 505 elements->set(cursor++, *TheHoleToUndefined(this, recv));
495 elements->set(cursor++, *fun); 506 elements->set(cursor++, *fun);
496 elements->set(cursor++, *abstract_code); 507 elements->set(cursor++, *abstract_code);
497 elements->set(cursor++, *offset); 508 elements->set(cursor++, *offset);
498 frames_seen++; 509 frames_seen++;
499 } 510 }
500 } break; 511 } break;
501 512
502 case StackFrame::BUILTIN_EXIT: { 513 case StackFrame::BUILTIN_EXIT: {
503 BuiltinExitFrame* exit_frame = BuiltinExitFrame::cast(frame); 514 BuiltinExitFrame* exit_frame = BuiltinExitFrame::cast(frame);
504 Handle<JSFunction> fun = handle(exit_frame->function(), this); 515 Handle<JSFunction> fun = handle(exit_frame->function(), this);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 970
960 Object* Isolate::StackOverflow() { 971 Object* Isolate::StackOverflow() {
961 DisallowJavascriptExecution no_js(this); 972 DisallowJavascriptExecution no_js(this);
962 HandleScope scope(this); 973 HandleScope scope(this);
963 974
964 Handle<JSFunction> fun = range_error_function(); 975 Handle<JSFunction> fun = range_error_function();
965 Handle<Object> msg = factory()->NewStringFromAsciiChecked( 976 Handle<Object> msg = factory()->NewStringFromAsciiChecked(
966 MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); 977 MessageTemplate::TemplateString(MessageTemplate::kStackOverflow));
967 Handle<Object> exception; 978 Handle<Object> exception;
968 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 979 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
969 this, exception, ConstructError(this, fun, fun, msg, SKIP_NONE, true)); 980 this, exception,
981 ErrorUtils::Construct(this, fun, fun, msg, SKIP_NONE, true));
970 982
971 Throw(*exception, nullptr); 983 Throw(*exception, nullptr);
972 984
973 #ifdef VERIFY_HEAP 985 #ifdef VERIFY_HEAP
974 if (FLAG_verify_heap && FLAG_stress_compaction) { 986 if (FLAG_verify_heap && FLAG_stress_compaction) {
975 heap()->CollectAllGarbage(Heap::kNoGCFlags, "trigger compaction"); 987 heap()->CollectAllGarbage(Heap::kNoGCFlags, "trigger compaction");
976 } 988 }
977 #endif // VERIFY_HEAP 989 #endif // VERIFY_HEAP
978 990
979 return heap()->exception(); 991 return heap()->exception();
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 // Then check whether this scope intercepts. 3179 // Then check whether this scope intercepts.
3168 if ((flag & intercept_mask_)) { 3180 if ((flag & intercept_mask_)) {
3169 intercepted_flags_ |= flag; 3181 intercepted_flags_ |= flag;
3170 return true; 3182 return true;
3171 } 3183 }
3172 return false; 3184 return false;
3173 } 3185 }
3174 3186
3175 } // namespace internal 3187 } // namespace internal
3176 } // namespace v8 3188 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/js/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698