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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 2252783007: Revert of Use a custom Struct for stack trace storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects-printer.cc ('k') | src/types.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 static_cast<MessageTemplate::Template>(message_id)); 108 static_cast<MessageTemplate::Template>(message_id));
109 109
110 // For wasm traps, the byte offset (a.k.a source position) can not be 110 // For wasm traps, the byte offset (a.k.a source position) can not be
111 // determined from relocation info, since the explicit checks for traps 111 // determined from relocation info, since the explicit checks for traps
112 // converge in one singe block which calls this runtime function. 112 // converge in one singe block which calls this runtime function.
113 // We hence pass the byte offset explicitely, and patch it into the top-most 113 // We hence pass the byte offset explicitely, and patch it into the top-most
114 // frame (a wasm frame) on the collected stack trace. 114 // frame (a wasm frame) on the collected stack trace.
115 // TODO(wasm): This implementation is temporary, see bug #5007: 115 // TODO(wasm): This implementation is temporary, see bug #5007:
116 // https://bugs.chromium.org/p/v8/issues/detail?id=5007 116 // https://bugs.chromium.org/p/v8/issues/detail?id=5007
117 Handle<JSObject> error = Handle<JSObject>::cast(error_obj); 117 Handle<JSObject> error = Handle<JSObject>::cast(error_obj);
118
119 // Patch the stack trace (array of <receiver, function, code, position>).
120
121 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty( 118 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty(
122 error, isolate->factory()->stack_trace_symbol()); 119 error, isolate->factory()->stack_trace_symbol());
120 // Patch the stack trace (array of <receiver, function, code, position>).
123 if (stack_trace_obj->IsJSArray()) { 121 if (stack_trace_obj->IsJSArray()) {
124 Handle<FixedArray> stack_elements( 122 Handle<FixedArray> stack_elements(
125 FixedArray::cast(JSArray::cast(*stack_trace_obj)->elements())); 123 FixedArray::cast(JSArray::cast(*stack_trace_obj)->elements()));
126 Handle<StackTraceFrame> frame = 124 DCHECK_EQ(1, stack_elements->length() % 4);
127 handle(StackTraceFrame::cast(stack_elements->get(0))); 125 DCHECK(Code::cast(stack_elements->get(3))->kind() == Code::WASM_FUNCTION);
128 126 DCHECK(stack_elements->get(4)->IsSmi() &&
129 DCHECK(frame->IsWasmFrame()); 127 Smi::cast(stack_elements->get(4))->value() >= 0);
130 DCHECK(frame->offset() >= 0); 128 stack_elements->set(4, Smi::FromInt(-1 - byte_offset));
131 frame->set_offset(-1 - byte_offset);
132 } 129 }
133 130 Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
131 error, isolate->factory()->detailed_stack_trace_symbol());
134 // Patch the detailed stack trace (array of JSObjects with various 132 // Patch the detailed stack trace (array of JSObjects with various
135 // properties). 133 // properties).
136
137 Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
138 error, isolate->factory()->detailed_stack_trace_symbol());
139 if (detailed_stack_trace_obj->IsJSArray()) { 134 if (detailed_stack_trace_obj->IsJSArray()) {
140 Handle<FixedArray> stack_elements( 135 Handle<FixedArray> stack_elements(
141 FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements())); 136 FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements()));
142 DCHECK_GE(stack_elements->length(), 1); 137 DCHECK_GE(stack_elements->length(), 1);
143 Handle<JSObject> top_frame(JSObject::cast(stack_elements->get(0))); 138 Handle<JSObject> top_frame(JSObject::cast(stack_elements->get(0)));
144 Handle<String> wasm_offset_key = 139 Handle<String> wasm_offset_key =
145 isolate->factory()->InternalizeOneByteString( 140 isolate->factory()->InternalizeOneByteString(
146 STATIC_CHAR_VECTOR("column")); 141 STATIC_CHAR_VECTOR("column"));
147 LookupIterator it(top_frame, wasm_offset_key, top_frame, 142 LookupIterator it(top_frame, wasm_offset_key, top_frame,
148 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 143 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 564
570 RUNTIME_FUNCTION(Runtime_Typeof) { 565 RUNTIME_FUNCTION(Runtime_Typeof) {
571 HandleScope scope(isolate); 566 HandleScope scope(isolate);
572 DCHECK_EQ(1, args.length()); 567 DCHECK_EQ(1, args.length());
573 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 568 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
574 return *Object::TypeOf(isolate, object); 569 return *Object::TypeOf(isolate, object);
575 } 570 }
576 571
577 } // namespace internal 572 } // namespace internal
578 } // namespace v8 573 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698