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

Side by Side Diff: src/wasm/wasm-objects.cc

Issue 2590833002: [wasm] Only SNPrintF the function index if a name was not supplied. (Closed)
Patch Set: Use embedded vector. 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 | 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/wasm/wasm-objects.h" 5 #include "src/wasm/wasm-objects.h"
6 #include "src/utils.h" 6 #include "src/utils.h"
7 7
8 #include "src/debug/debug-interface.h" 8 #include "src/debug/debug-interface.h"
9 #include "src/wasm/module-decoder.h" 9 #include "src/wasm/module-decoder.h"
10 #include "src/wasm/wasm-module.h" 10 #include "src/wasm/wasm-module.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DCHECK_EQ(Code::JS_TO_WASM_FUNCTION, 305 DCHECK_EQ(Code::JS_TO_WASM_FUNCTION,
306 JSFunction::cast(object)->code()->kind()); 306 JSFunction::cast(object)->code()->kind());
307 // TODO(titzer): brand check for WasmExportedFunction. 307 // TODO(titzer): brand check for WasmExportedFunction.
308 return reinterpret_cast<WasmExportedFunction*>(object); 308 return reinterpret_cast<WasmExportedFunction*>(object);
309 } 309 }
310 310
311 Handle<WasmExportedFunction> WasmExportedFunction::New( 311 Handle<WasmExportedFunction> WasmExportedFunction::New(
312 Isolate* isolate, Handle<WasmInstanceObject> instance, 312 Isolate* isolate, Handle<WasmInstanceObject> instance,
313 MaybeHandle<String> maybe_name, int func_index, int arity, 313 MaybeHandle<String> maybe_name, int func_index, int arity,
314 Handle<Code> export_wrapper) { 314 Handle<Code> export_wrapper) {
315 ScopedVector<char> buffer(16);
316 int length = SNPrintF(buffer, "%d", func_index);
317 Handle<String> name; 315 Handle<String> name;
318 if (maybe_name.is_null()) { 316 if (maybe_name.is_null()) {
317 EmbeddedVector<char, 16> buffer;
318 int length = SNPrintF(buffer, "%d", func_index);
319 name = isolate->factory() 319 name = isolate->factory()
320 ->NewStringFromAscii( 320 ->NewStringFromAscii(
321 Vector<const char>::cast(buffer.SubVector(0, length))) 321 Vector<const char>::cast(buffer.SubVector(0, length)))
322 .ToHandleChecked(); 322 .ToHandleChecked();
323 } else { 323 } else {
324 name = maybe_name.ToHandleChecked(); 324 name = maybe_name.ToHandleChecked();
325 } 325 }
326 DCHECK_EQ(Code::JS_TO_WASM_FUNCTION, export_wrapper->kind()); 326 DCHECK_EQ(Code::JS_TO_WASM_FUNCTION, export_wrapper->kind());
327 Handle<SharedFunctionInfo> shared = 327 Handle<SharedFunctionInfo> shared =
328 isolate->factory()->NewSharedFunctionInfo(name, export_wrapper, false); 328 isolate->factory()->NewSharedFunctionInfo(name, export_wrapper, false);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) 747 !array->get(kPreviousInstanceWrapper)->IsFixedArray())
748 return false; 748 return false;
749 return true; 749 return true;
750 } 750 }
751 751
752 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, 752 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance,
753 Isolate* isolate) { 753 Isolate* isolate) {
754 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); 754 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance);
755 set(kWrapperInstanceObject, *cell); 755 set(kWrapperInstanceObject, *cell);
756 } 756 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698