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

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

Issue 2270783002: Add new FrameArray type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments 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-inl.h ('k') | no next file » | 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // converge in one singe block which calls this runtime function. 113 // converge in one singe block which calls this runtime function.
114 // We hence pass the byte offset explicitely, and patch it into the top-most 114 // We hence pass the byte offset explicitely, and patch it into the top-most
115 // frame (a wasm frame) on the collected stack trace. 115 // frame (a wasm frame) on the collected stack trace.
116 // TODO(wasm): This implementation is temporary, see bug #5007: 116 // TODO(wasm): This implementation is temporary, see bug #5007:
117 // https://bugs.chromium.org/p/v8/issues/detail?id=5007 117 // https://bugs.chromium.org/p/v8/issues/detail?id=5007
118 Handle<JSObject> error = Handle<JSObject>::cast(error_obj); 118 Handle<JSObject> error = Handle<JSObject>::cast(error_obj);
119 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty( 119 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty(
120 error, isolate->factory()->stack_trace_symbol()); 120 error, isolate->factory()->stack_trace_symbol());
121 // Patch the stack trace (array of <receiver, function, code, position>). 121 // Patch the stack trace (array of <receiver, function, code, position>).
122 if (stack_trace_obj->IsJSArray()) { 122 if (stack_trace_obj->IsJSArray()) {
123 Handle<FixedArray> stack_elements( 123 Handle<FrameArray> stack_elements(
124 FixedArray::cast(JSArray::cast(*stack_trace_obj)->elements())); 124 FrameArray::cast(JSArray::cast(*stack_trace_obj)->elements()));
125 DCHECK_EQ(1, stack_elements->length() % 4); 125 DCHECK(stack_elements->Code(0)->kind() == AbstractCode::WASM_FUNCTION);
126 DCHECK(Code::cast(stack_elements->get(3))->kind() == Code::WASM_FUNCTION); 126 DCHECK(stack_elements->Offset(0)->value() >= 0);
127 DCHECK(stack_elements->get(4)->IsSmi() && 127 stack_elements->SetOffset(0, Smi::FromInt(-1 - byte_offset));
128 Smi::cast(stack_elements->get(4))->value() >= 0);
129 stack_elements->set(4, Smi::FromInt(-1 - byte_offset));
130 } 128 }
129
130 // Patch the detailed stack trace (array of JSObjects with various
131 // properties).
131 Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty( 132 Handle<Object> detailed_stack_trace_obj = JSReceiver::GetDataProperty(
132 error, isolate->factory()->detailed_stack_trace_symbol()); 133 error, isolate->factory()->detailed_stack_trace_symbol());
133 // Patch the detailed stack trace (array of JSObjects with various
134 // properties).
135 if (detailed_stack_trace_obj->IsJSArray()) { 134 if (detailed_stack_trace_obj->IsJSArray()) {
136 Handle<FixedArray> stack_elements( 135 Handle<FixedArray> stack_elements(
137 FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements())); 136 FixedArray::cast(JSArray::cast(*detailed_stack_trace_obj)->elements()));
138 DCHECK_GE(stack_elements->length(), 1); 137 DCHECK_GE(stack_elements->length(), 1);
139 Handle<JSObject> top_frame(JSObject::cast(stack_elements->get(0))); 138 Handle<JSObject> top_frame(JSObject::cast(stack_elements->get(0)));
140 Handle<String> wasm_offset_key = 139 Handle<String> wasm_offset_key =
141 isolate->factory()->InternalizeOneByteString( 140 isolate->factory()->InternalizeOneByteString(
142 STATIC_CHAR_VECTOR("column")); 141 STATIC_CHAR_VECTOR("column"));
143 LookupIterator it(top_frame, wasm_offset_key, top_frame, 142 LookupIterator it(top_frame, wasm_offset_key, top_frame,
144 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 143 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 562
564 RUNTIME_FUNCTION(Runtime_Typeof) { 563 RUNTIME_FUNCTION(Runtime_Typeof) {
565 HandleScope scope(isolate); 564 HandleScope scope(isolate);
566 DCHECK_EQ(1, args.length()); 565 DCHECK_EQ(1, args.length());
567 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 566 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
568 return *Object::TypeOf(isolate, object); 567 return *Object::TypeOf(isolate, object);
569 } 568 }
570 569
571 } // namespace internal 570 } // namespace internal
572 } // namespace v8 571 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698