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/isolate.cc

Issue 2191293002: Move FormatStackTrace to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation in release mode 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
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 compilation_cache_(NULL), 1928 compilation_cache_(NULL),
1917 counters_(NULL), 1929 counters_(NULL),
1918 logger_(NULL), 1930 logger_(NULL),
1919 stats_table_(NULL), 1931 stats_table_(NULL),
1920 load_stub_cache_(NULL), 1932 load_stub_cache_(NULL),
1921 store_stub_cache_(NULL), 1933 store_stub_cache_(NULL),
1922 code_aging_helper_(NULL), 1934 code_aging_helper_(NULL),
1923 deoptimizer_data_(NULL), 1935 deoptimizer_data_(NULL),
1924 deoptimizer_lazy_throw_(false), 1936 deoptimizer_lazy_throw_(false),
1925 materialized_object_store_(NULL), 1937 materialized_object_store_(NULL),
1938 formatting_stack_trace_(false),
1926 capture_stack_trace_for_uncaught_exceptions_(false), 1939 capture_stack_trace_for_uncaught_exceptions_(false),
1927 stack_trace_for_uncaught_exceptions_frame_limit_(0), 1940 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1928 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 1941 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1929 keyed_lookup_cache_(NULL), 1942 keyed_lookup_cache_(NULL),
1930 context_slot_cache_(NULL), 1943 context_slot_cache_(NULL),
1931 descriptor_lookup_cache_(NULL), 1944 descriptor_lookup_cache_(NULL),
1932 handle_scope_implementer_(NULL), 1945 handle_scope_implementer_(NULL),
1933 unicode_cache_(NULL), 1946 unicode_cache_(NULL),
1934 allocator_(FLAG_trace_gc_object_stats 1947 allocator_(FLAG_trace_gc_object_stats
1935 ? new VerboseAccountingAllocator(&heap_, 256 * KB) 1948 ? new VerboseAccountingAllocator(&heap_, 256 * KB)
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 // Then check whether this scope intercepts. 3180 // Then check whether this scope intercepts.
3168 if ((flag & intercept_mask_)) { 3181 if ((flag & intercept_mask_)) {
3169 intercepted_flags_ |= flag; 3182 intercepted_flags_ |= flag;
3170 return true; 3183 return true;
3171 } 3184 }
3172 return false; 3185 return false;
3173 } 3186 }
3174 3187
3175 } // namespace internal 3188 } // namespace internal
3176 } // namespace v8 3189 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698