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

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

Issue 2010493002: Check CallSite arguments more rigorously (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove unneeded cast Created 4 years, 6 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
« src/messages.cc ('K') | « src/wasm/wasm-module.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 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/base/atomic-utils.h" 5 #include "src/base/atomic-utils.h"
6 #include "src/macro-assembler.h" 6 #include "src/macro-assembler.h"
7 #include "src/objects.h" 7 #include "src/objects.h"
8 #include "src/property-descriptor.h" 8 #include "src/property-descriptor.h"
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 971 }
972 if (result->IsHeapNumber()) { 972 if (result->IsHeapNumber()) {
973 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); 973 return static_cast<int32_t>(HeapNumber::cast(*result)->value());
974 } 974 }
975 thrower.Error("WASM.compileRun() failed: Return value should be number"); 975 thrower.Error("WASM.compileRun() failed: Return value should be number");
976 return -1; 976 return -1;
977 } 977 }
978 978
979 MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm, 979 MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm,
980 uint32_t func_index) { 980 uint32_t func_index) {
981 DCHECK(IsWasmObject(wasm));
981 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray); 982 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray);
982 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null(); 983 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null();
983 return GetWasmFunctionNameFromTable( 984 return GetWasmFunctionNameFromTable(
984 handle(ByteArray::cast(func_names_arr_obj)), func_index); 985 handle(ByteArray::cast(func_names_arr_obj)), func_index);
985 } 986 }
986 987
988 bool IsWasmObject(Handle<JSObject> object) {
989 // TODO(clemensh): Check wasm byte header once we store a copy of the bytes.
990 return object->GetInternalFieldCount() == kWasmModuleInternalFieldCount &&
991 object->GetInternalField(kWasmModuleCodeTable)->IsFixedArray() &&
992 object->GetInternalField(kWasmMemArrayBuffer)->IsJSArrayBuffer() &&
993 (object->GetInternalField(kWasmFunctionNamesArray)->IsByteArray() ||
994 object->GetInternalField(kWasmFunctionNamesArray)->IsUndefined());
995 }
996
987 } // namespace wasm 997 } // namespace wasm
988 } // namespace internal 998 } // namespace internal
989 } // namespace v8 999 } // namespace v8
OLDNEW
« src/messages.cc ('K') | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698