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

Side by Side Diff: src/isolate.cc

Issue 2548323002: [wasm] Implement location from stack trace for asm.js frames (Closed)
Patch Set: Created 4 years 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 | « no previous file | test/mjsunit/regress/regress-670808.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 29 matching lines...) Expand all
40 #include "src/prototype.h" 40 #include "src/prototype.h"
41 #include "src/regexp/regexp-stack.h" 41 #include "src/regexp/regexp-stack.h"
42 #include "src/runtime-profiler.h" 42 #include "src/runtime-profiler.h"
43 #include "src/simulator.h" 43 #include "src/simulator.h"
44 #include "src/snapshot/deserializer.h" 44 #include "src/snapshot/deserializer.h"
45 #include "src/tracing/tracing-category-observer.h" 45 #include "src/tracing/tracing-category-observer.h"
46 #include "src/v8.h" 46 #include "src/v8.h"
47 #include "src/version.h" 47 #include "src/version.h"
48 #include "src/vm-state-inl.h" 48 #include "src/vm-state-inl.h"
49 #include "src/wasm/wasm-module.h" 49 #include "src/wasm/wasm-module.h"
50 #include "src/wasm/wasm-objects.h"
50 #include "src/zone/accounting-allocator.h" 51 #include "src/zone/accounting-allocator.h"
51 52
52 namespace v8 { 53 namespace v8 {
53 namespace internal { 54 namespace internal {
54 55
55 base::Atomic32 ThreadId::highest_thread_id_ = 0; 56 base::Atomic32 ThreadId::highest_thread_id_ = 0;
56 57
57 int ThreadId::AllocateThreadId() { 58 int ThreadId::AllocateThreadId() {
58 int new_id = base::NoBarrier_AtomicIncrement(&highest_thread_id_, 1); 59 int new_id = base::NoBarrier_AtomicIncrement(&highest_thread_id_, 1);
59 return new_id; 60 return new_id;
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 Handle<Object> script = JSReceiver::GetDataProperty( 1526 Handle<Object> script = JSReceiver::GetDataProperty(
1526 Handle<JSObject>::cast(exception), script_symbol); 1527 Handle<JSObject>::cast(exception), script_symbol);
1527 if (!script->IsScript()) return false; 1528 if (!script->IsScript()) return false;
1528 1529
1529 Handle<Script> cast_script(Script::cast(*script)); 1530 Handle<Script> cast_script(Script::cast(*script));
1530 *target = MessageLocation(cast_script, start_pos_value, end_pos_value); 1531 *target = MessageLocation(cast_script, start_pos_value, end_pos_value);
1531 return true; 1532 return true;
1532 } 1533 }
1533 1534
1534 1535
1535 bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target, 1536 bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
titzer 2016/12/05 12:14:36 Can you add a comment explaining what this does (b
Clemens Hammacher 2016/12/05 12:27:28 isolate.h provides this documentation: // Attempts
1536 Handle<Object> exception) { 1537 Handle<Object> exception) {
1537 if (!exception->IsJSObject()) return false; 1538 if (!exception->IsJSObject()) return false;
1538 Handle<Name> key = factory()->stack_trace_symbol(); 1539 Handle<Name> key = factory()->stack_trace_symbol();
1539 Handle<Object> property = 1540 Handle<Object> property =
1540 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); 1541 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key);
1541 if (!property->IsJSArray()) return false; 1542 if (!property->IsJSArray()) return false;
1542 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); 1543 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
1543 1544
1544 Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements())); 1545 Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements()));
1545 1546
1546 const int frame_count = elements->FrameCount(); 1547 const int frame_count = elements->FrameCount();
1547 for (int i = 0; i < frame_count; i++) { 1548 for (int i = 0; i < frame_count; i++) {
1548 if (elements->IsWasmFrame(i)) { 1549 if (elements->IsWasmFrame(i)) {
1549 // TODO(clemensh): handle wasm frames 1550 // TODO(clemensh): Handle wasm frames if they ever need handling here.
1550 return false; 1551 continue;
1552 }
1553
1554 if (elements->IsAsmJsWasmFrame(i)) {
1555 Handle<WasmCompiledModule> compiled_module(
1556 WasmInstanceObject::cast(elements->WasmInstance(i))
1557 ->get_compiled_module());
1558 int func_index = elements->WasmFunctionIndex(i)->value();
1559 int code_offset = elements->Offset(i)->value();
1560 int byte_pos = elements->Code(i)->SourcePosition(code_offset);
1561 int source_pos = WasmCompiledModule::GetAsmJsSourcePosition(
1562 compiled_module, func_index, byte_pos);
1563 Handle<Script> script = compiled_module->script();
1564
1565 *target = MessageLocation(script, source_pos, source_pos + 1);
1566 return true;
1551 } 1567 }
1552 1568
1553 Handle<JSFunction> fun = handle(elements->Function(i), this); 1569 Handle<JSFunction> fun = handle(elements->Function(i), this);
1554 if (!fun->shared()->IsSubjectToDebugging()) continue; 1570 if (!fun->shared()->IsSubjectToDebugging()) continue;
1555 1571
1556 Object* script = fun->shared()->script(); 1572 Object* script = fun->shared()->script();
1557 if (script->IsScript() && 1573 if (script->IsScript() &&
1558 !(Script::cast(script)->source()->IsUndefined(this))) { 1574 !(Script::cast(script)->source()->IsUndefined(this))) {
1559 AbstractCode* abstract_code = elements->Code(i); 1575 AbstractCode* abstract_code = elements->Code(i);
1560 const int code_offset = elements->Offset(i)->value(); 1576 const int code_offset = elements->Offset(i)->value();
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 // Then check whether this scope intercepts. 3535 // Then check whether this scope intercepts.
3520 if ((flag & intercept_mask_)) { 3536 if ((flag & intercept_mask_)) {
3521 intercepted_flags_ |= flag; 3537 intercepted_flags_ |= flag;
3522 return true; 3538 return true;
3523 } 3539 }
3524 return false; 3540 return false;
3525 } 3541 }
3526 3542
3527 } // namespace internal 3543 } // namespace internal
3528 } // namespace v8 3544 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-670808.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698