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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 // Required to get M_E etc. in MSVC. | 7 // Required to get M_E etc. in MSVC. |
8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
9 #define _USE_MATH_DEFINES | 9 #define _USE_MATH_DEFINES |
10 #endif | 10 #endif |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 container->index = index; | 1691 container->index = index; |
1692 entry = local_variables_.LookupOrInsert(v, ComputePointerHash(v), | 1692 entry = local_variables_.LookupOrInsert(v, ComputePointerHash(v), |
1693 ZoneAllocationPolicy(zone())); | 1693 ZoneAllocationPolicy(zone())); |
1694 entry->value = container; | 1694 entry->value = container; |
1695 } | 1695 } |
1696 | 1696 |
1697 uint32_t LookupOrInsertGlobal(Variable* v, LocalType type) { | 1697 uint32_t LookupOrInsertGlobal(Variable* v, LocalType type) { |
1698 ZoneHashMap::Entry* entry = | 1698 ZoneHashMap::Entry* entry = |
1699 global_variables_.Lookup(v, ComputePointerHash(v)); | 1699 global_variables_.Lookup(v, ComputePointerHash(v)); |
1700 if (entry == nullptr) { | 1700 if (entry == nullptr) { |
1701 uint32_t index = | 1701 uint32_t index = builder_->AddGlobal(type, 0); |
1702 builder_->AddGlobal(WasmOpcodes::MachineTypeFor(type), 0); | |
1703 IndexContainer* container = new (zone()) IndexContainer(); | 1702 IndexContainer* container = new (zone()) IndexContainer(); |
1704 container->index = index; | 1703 container->index = index; |
1705 entry = global_variables_.LookupOrInsert(v, ComputePointerHash(v), | 1704 entry = global_variables_.LookupOrInsert(v, ComputePointerHash(v), |
1706 ZoneAllocationPolicy(zone())); | 1705 ZoneAllocationPolicy(zone())); |
1707 entry->value = container; | 1706 entry->value = container; |
1708 } | 1707 } |
1709 return (reinterpret_cast<IndexContainer*>(entry->value))->index; | 1708 return (reinterpret_cast<IndexContainer*>(entry->value))->index; |
1710 } | 1709 } |
1711 | 1710 |
1712 uint32_t LookupOrInsertFunction(Variable* v) { | 1711 uint32_t LookupOrInsertFunction(Variable* v) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); | 1776 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); |
1778 impl.Build(); | 1777 impl.Build(); |
1779 *foreign_args = impl.GetForeignArgs(); | 1778 *foreign_args = impl.GetForeignArgs(); |
1780 ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_); | 1779 ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_); |
1781 impl.builder_->WriteTo(*buffer); | 1780 impl.builder_->WriteTo(*buffer); |
1782 return buffer; | 1781 return buffer; |
1783 } | 1782 } |
1784 } // namespace wasm | 1783 } // namespace wasm |
1785 } // namespace internal | 1784 } // namespace internal |
1786 } // namespace v8 | 1785 } // namespace v8 |
OLD | NEW |