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

Side by Side Diff: src/wasm/asm-wasm-builder.cc

Issue 1750153002: Replace __init__ function in asm-wasm-builder with the start function section (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | src/wasm/encoder.h » ('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/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 init_function_index_(0), 59 init_function_index_(0),
60 next_table_index_(0), 60 next_table_index_(0),
61 function_tables_(HashMap::PointersMatch, 61 function_tables_(HashMap::PointersMatch,
62 ZoneHashMap::kDefaultHashMapCapacity, 62 ZoneHashMap::kDefaultHashMapCapacity,
63 ZoneAllocationPolicy(zone)), 63 ZoneAllocationPolicy(zone)),
64 imported_function_table_(this) { 64 imported_function_table_(this) {
65 InitializeAstVisitor(isolate); 65 InitializeAstVisitor(isolate);
66 } 66 }
67 67
68 void InitializeInitFunction() { 68 void InitializeInitFunction() {
69 unsigned char init[] = "__init__";
70 init_function_index_ = builder_->AddFunction(); 69 init_function_index_ = builder_->AddFunction();
71 current_function_builder_ = builder_->FunctionAt(init_function_index_); 70 current_function_builder_ = builder_->FunctionAt(init_function_index_);
72 current_function_builder_->SetName(init, 8);
73 current_function_builder_->ReturnType(kAstStmt); 71 current_function_builder_->ReturnType(kAstStmt);
74 current_function_builder_->Exported(1); 72 builder_->MarkStartFunction(init_function_index_);
75 current_function_builder_ = nullptr; 73 current_function_builder_ = nullptr;
76 } 74 }
77 75
78 void Compile() { 76 void Compile() {
79 InitializeInitFunction(); 77 InitializeInitFunction();
80 RECURSE(VisitFunctionLiteral(literal_)); 78 RECURSE(VisitFunctionLiteral(literal_));
81 } 79 }
82 80
83 void VisitVariableDeclaration(VariableDeclaration* decl) {} 81 void VisitVariableDeclaration(VariableDeclaration* decl) {}
84 82
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 // that zone in constructor may be thrown away once wasm module is written. 1505 // that zone in constructor may be thrown away once wasm module is written.
1508 WasmModuleIndex* AsmWasmBuilder::Run() { 1506 WasmModuleIndex* AsmWasmBuilder::Run() {
1509 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_, typer_); 1507 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_, typer_);
1510 impl.Compile(); 1508 impl.Compile();
1511 WasmModuleWriter* writer = impl.builder_->Build(zone_); 1509 WasmModuleWriter* writer = impl.builder_->Build(zone_);
1512 return writer->WriteTo(zone_); 1510 return writer->WriteTo(zone_);
1513 } 1511 }
1514 } // namespace wasm 1512 } // namespace wasm
1515 } // namespace internal 1513 } // namespace internal
1516 } // namespace v8 1514 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698