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 bool UpdateWasmModuleMemory(JSObject* object, Address old_start, | |
1030 Address new_start, uint32_t old_size, | |
1031 uint32_t new_size) { | |
1032 if (!IsWasmObject(object)) { | |
1033 return false; | |
1034 } | |
1035 | |
1036 // Get code table associated with the module js_object | |
1037 Object* obj = object->GetInternalField(kWasmModuleCodeTable); | |
1038 Handle<FixedArray> code_table; | |
ahaas
2016/06/28 14:51:50
Use Handle<FixedArray> code_table(FixedArray::cast
gdeepti
2016/06/28 16:19:10
Done.
| |
1039 code_table = Handle<FixedArray>(FixedArray::cast(obj)); | |
1040 | |
1041 // Iterate through the code objects in the code table and update relocation | |
1042 // information | |
1043 for (int i = 0; i < code_table->length(); i++) { | |
1044 obj = code_table->get(i); | |
1045 Handle<Code> code(Code::cast(obj)); | |
1046 | |
1047 int mode_mask = RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_REFERENCE) | | |
1048 RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_SIZE_REFERENCE); | |
1049 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | |
1050 RelocInfo::Mode mode = it.rinfo()->rmode(); | |
1051 if (RelocInfo::IsWasmMemoryReference(mode) || | |
1052 RelocInfo::IsWasmMemorySizeReference(mode)) { | |
1053 it.rinfo()->update_wasm_memory_reference(old_start, new_start, old_size, | |
1054 new_size); | |
1055 } | |
1056 } | |
1057 } | |
1058 return true; | |
1059 } | |
1060 | |
1029 namespace testing { | 1061 namespace testing { |
1030 | 1062 |
1031 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 1063 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
1032 const byte* module_end, bool asm_js) { | 1064 const byte* module_end, bool asm_js) { |
1033 HandleScope scope(isolate); | 1065 HandleScope scope(isolate); |
1034 Zone zone(isolate->allocator()); | 1066 Zone zone(isolate->allocator()); |
1035 ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); | 1067 ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); |
1036 | 1068 |
1037 // Decode the module, but don't verify function bodies, since we'll | 1069 // Decode the module, but don't verify function bodies, since we'll |
1038 // be compiling them anyway. | 1070 // be compiling them anyway. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); | 1124 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); |
1093 } | 1125 } |
1094 thrower.Error("WASM.compileRun() failed: Return value should be number"); | 1126 thrower.Error("WASM.compileRun() failed: Return value should be number"); |
1095 return -1; | 1127 return -1; |
1096 } | 1128 } |
1097 | 1129 |
1098 } // namespace testing | 1130 } // namespace testing |
1099 } // namespace wasm | 1131 } // namespace wasm |
1100 } // namespace internal | 1132 } // namespace internal |
1101 } // namespace v8 | 1133 } // namespace v8 |
OLD | NEW |