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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 current_function_builder_->EmitWithVarInt( | 557 current_function_builder_->EmitWithVarInt( |
558 kExprGetGlobal, LookupOrInsertGlobal(var, var_type)); | 558 kExprGetGlobal, LookupOrInsertGlobal(var, var_type)); |
559 } else { | 559 } else { |
560 current_function_builder_->EmitGetLocal( | 560 current_function_builder_->EmitGetLocal( |
561 LookupOrInsertLocal(var, var_type)); | 561 LookupOrInsertLocal(var, var_type)); |
562 } | 562 } |
563 } else if (scope_ == kExportScope) { | 563 } else if (scope_ == kExportScope) { |
564 Variable* var = expr->var(); | 564 Variable* var = expr->var(); |
565 DCHECK(var->is_function()); | 565 DCHECK(var->is_function()); |
566 WasmFunctionBuilder* function = LookupOrInsertFunction(var); | 566 WasmFunctionBuilder* function = LookupOrInsertFunction(var); |
567 function->SetExported(); | 567 function->SetExportedWithName( |
titzer
2016/10/11 08:08:48
How about ExportAs()?
(we should work incremental
Clemens Hammacher
2016/10/11 08:21:54
Is SetExportedAs better?
IMHO Export() and ExportA
titzer
2016/10/11 08:36:03
Indeed, it does a memcpy of the underlying name an
| |
568 function->SetName( | |
569 AsmWasmBuilder::single_function_name, | 568 AsmWasmBuilder::single_function_name, |
570 static_cast<int>(strlen(AsmWasmBuilder::single_function_name))); | 569 static_cast<int>(strlen(AsmWasmBuilder::single_function_name))); |
571 } | 570 } |
572 } | 571 } |
573 | 572 |
574 void VisitLiteral(Literal* expr) { | 573 void VisitLiteral(Literal* expr) { |
575 Handle<Object> value = expr->value(); | 574 Handle<Object> value = expr->value(); |
576 if (!(value->IsNumber() || expr->raw_value()->IsTrue() || | 575 if (!(value->IsNumber() || expr->raw_value()->IsTrue() || |
577 expr->raw_value()->IsFalse()) || | 576 expr->raw_value()->IsFalse()) || |
578 (scope_ != kFuncScope && scope_ != kInitScope)) { | 577 (scope_ != kFuncScope && scope_ != kInitScope)) { |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 impl.builder_->WriteTo(*buffer); | 1886 impl.builder_->WriteTo(*buffer); |
1888 return buffer; | 1887 return buffer; |
1889 } | 1888 } |
1890 | 1889 |
1891 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; | 1890 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; |
1892 const char* AsmWasmBuilder::single_function_name = "__single_function__"; | 1891 const char* AsmWasmBuilder::single_function_name = "__single_function__"; |
1893 | 1892 |
1894 } // namespace wasm | 1893 } // namespace wasm |
1895 } // namespace internal | 1894 } // namespace internal |
1896 } // namespace v8 | 1895 } // namespace v8 |
OLD | NEW |