Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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> HoleToUndefined(Isolate* isolate, Handle<Object> in) { | |
|
Yang
2016/08/01 06:49:18
Let's call this TheHoleToUndefined.
jgruber
2016/08/01 10:52:55
Done.
| |
| 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 Loading... | |
| 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++, *HoleToUndefined(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 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3167 // Then check whether this scope intercepts. | 3178 // Then check whether this scope intercepts. |
| 3168 if ((flag & intercept_mask_)) { | 3179 if ((flag & intercept_mask_)) { |
| 3169 intercepted_flags_ |= flag; | 3180 intercepted_flags_ |= flag; |
| 3170 return true; | 3181 return true; |
| 3171 } | 3182 } |
| 3172 return false; | 3183 return false; |
| 3173 } | 3184 } |
| 3174 | 3185 |
| 3175 } // namespace internal | 3186 } // namespace internal |
| 3176 } // namespace v8 | 3187 } // namespace v8 |
| OLD | NEW |