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

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: add regression test case 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
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/regress/regress-crbug-615774.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 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 } 954 }
955 if (result->IsHeapNumber()) { 955 if (result->IsHeapNumber()) {
956 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); 956 return static_cast<int32_t>(HeapNumber::cast(*result)->value());
957 } 957 }
958 thrower.Error("WASM.compileRun() failed: Return value should be number"); 958 thrower.Error("WASM.compileRun() failed: Return value should be number");
959 return -1; 959 return -1;
960 } 960 }
961 961
962 MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm, 962 MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm,
963 uint32_t func_index) { 963 uint32_t func_index) {
964 DCHECK(IsWasmObject(wasm));
964 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray); 965 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray);
965 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null(); 966 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null();
966 return GetWasmFunctionNameFromTable( 967 return GetWasmFunctionNameFromTable(
967 handle(ByteArray::cast(func_names_arr_obj)), func_index); 968 handle(ByteArray::cast(func_names_arr_obj)), func_index);
968 } 969 }
969 970
971 bool IsWasmObject(Handle<JSObject> object) {
972 // TODO(clemensh): Check wasm byte header once we store a copy of the bytes.
973 return object->GetInternalFieldCount() == kWasmModuleInternalFieldCount &&
974 object->GetInternalField(kWasmModuleCodeTable)->IsFixedArray() &&
975 object->GetInternalField(kWasmMemArrayBuffer)->IsJSArrayBuffer() &&
976 (object->GetInternalField(kWasmFunctionNamesArray)->IsByteArray() ||
977 object->GetInternalField(kWasmFunctionNamesArray)->IsUndefined());
978 }
979
970 } // namespace wasm 980 } // namespace wasm
971 } // namespace internal 981 } // namespace internal
972 } // namespace v8 982 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/regress/regress-crbug-615774.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698