| OLD | NEW |
| 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 WasmDebugInfo* GetDebugInfo(JSObject* wasm) { | 1021 WasmDebugInfo* GetDebugInfo(JSObject* wasm) { |
| 1022 Object* info = wasm->GetInternalField(kWasmDebugInfo); | 1022 Object* info = wasm->GetInternalField(kWasmDebugInfo); |
| 1023 if (!info->IsUndefined(wasm->GetIsolate())) return WasmDebugInfo::cast(info); | 1023 if (!info->IsUndefined(wasm->GetIsolate())) return WasmDebugInfo::cast(info); |
| 1024 Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(handle(wasm)); | 1024 Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(handle(wasm)); |
| 1025 wasm->SetInternalField(kWasmDebugInfo, *new_info); | 1025 wasm->SetInternalField(kWasmDebugInfo, *new_info); |
| 1026 return *new_info; | 1026 return *new_info; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 int GetNumberOfFunctions(JSObject* wasm) { |
| 1030 Object* func_names_obj = wasm->GetInternalField(kWasmFunctionNamesArray); |
| 1031 // TODO(clemensh): this looks inside an array constructed elsewhere. Refactor. |
| 1032 return ByteArray::cast(func_names_obj)->get_int(0); |
| 1033 } |
| 1034 |
| 1029 namespace testing { | 1035 namespace testing { |
| 1030 | 1036 |
| 1031 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 1037 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
| 1032 const byte* module_end, bool asm_js) { | 1038 const byte* module_end, bool asm_js) { |
| 1033 HandleScope scope(isolate); | 1039 HandleScope scope(isolate); |
| 1034 Zone zone(isolate->allocator()); | 1040 Zone zone(isolate->allocator()); |
| 1035 ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); | 1041 ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); |
| 1036 | 1042 |
| 1037 // Decode the module, but don't verify function bodies, since we'll | 1043 // Decode the module, but don't verify function bodies, since we'll |
| 1038 // be compiling them anyway. | 1044 // be compiling them anyway. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); | 1096 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); |
| 1091 } | 1097 } |
| 1092 thrower.Error("WASM.compileRun() failed: Return value should be number"); | 1098 thrower.Error("WASM.compileRun() failed: Return value should be number"); |
| 1093 return -1; | 1099 return -1; |
| 1094 } | 1100 } |
| 1095 | 1101 |
| 1096 } // namespace testing | 1102 } // namespace testing |
| 1097 } // namespace wasm | 1103 } // namespace wasm |
| 1098 } // namespace internal | 1104 } // namespace internal |
| 1099 } // namespace v8 | 1105 } // namespace v8 |
| OLD | NEW |