Chromium Code Reviews| 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/typing-asm.h" | 5 #include "src/typing-asm.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 } while (false) | 37 } while (false) |
| 38 | 38 |
| 39 AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script, | 39 AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script, |
| 40 FunctionLiteral* root) | 40 FunctionLiteral* root) |
| 41 : zone_(zone), | 41 : zone_(zone), |
| 42 isolate_(isolate), | 42 isolate_(isolate), |
| 43 script_(script), | 43 script_(script), |
| 44 root_(root), | 44 root_(root), |
| 45 valid_(true), | 45 valid_(true), |
| 46 allow_simd_(false), | 46 allow_simd_(false), |
| 47 fixed_signature_(false), | |
| 47 property_info_(nullptr), | 48 property_info_(nullptr), |
| 48 intish_(0), | 49 intish_(0), |
| 49 stdlib_types_(zone), | 50 stdlib_types_(zone), |
| 50 stdlib_heap_types_(zone), | 51 stdlib_heap_types_(zone), |
| 51 stdlib_math_types_(zone), | 52 stdlib_math_types_(zone), |
| 52 #define V(NAME, Name, name, lane_count, lane_type) \ | 53 #define V(NAME, Name, name, lane_count, lane_type) \ |
| 53 stdlib_simd_##name##_types_(zone), | 54 stdlib_simd_##name##_types_(zone), |
| 54 SIMD128_TYPES(V) | 55 SIMD128_TYPES(V) |
| 55 #undef V | 56 #undef V |
| 56 global_variable_type_(base::HashMap::PointersMatch, | 57 global_variable_type_(base::HashMap::PointersMatch, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 79 Scope* scope = fun->scope(); | 80 Scope* scope = fun->scope(); |
| 80 if (!scope->is_function_scope()) FAIL(fun, "not at function scope"); | 81 if (!scope->is_function_scope()) FAIL(fun, "not at function scope"); |
| 81 | 82 |
| 82 ExpressionStatement* use_asm = fun->body()->first()->AsExpressionStatement(); | 83 ExpressionStatement* use_asm = fun->body()->first()->AsExpressionStatement(); |
| 83 if (use_asm == nullptr) FAIL(fun, "missing \"use asm\""); | 84 if (use_asm == nullptr) FAIL(fun, "missing \"use asm\""); |
| 84 Literal* use_asm_literal = use_asm->expression()->AsLiteral(); | 85 Literal* use_asm_literal = use_asm->expression()->AsLiteral(); |
| 85 if (use_asm_literal == nullptr) FAIL(fun, "missing \"use asm\""); | 86 if (use_asm_literal == nullptr) FAIL(fun, "missing \"use asm\""); |
| 86 if (!use_asm_literal->raw_value()->AsString()->IsOneByteEqualTo("use asm")) | 87 if (!use_asm_literal->raw_value()->AsString()->IsOneByteEqualTo("use asm")) |
| 87 FAIL(fun, "missing \"use asm\""); | 88 FAIL(fun, "missing \"use asm\""); |
| 88 | 89 |
| 90 // TODO(bradnelson): Generalize this. | |
| 91 if (fixed_signature_ && scope->num_parameters() != 3) { | |
| 92 FAIL(fun, "only 3 parameter modules supported"); | |
|
Mircea Trofin
2016/06/30 23:23:29
what's a 3-parameter module?
bradn
2016/07/01 01:06:08
Clarified.
| |
| 93 } | |
| 94 | |
| 89 // Module parameters. | 95 // Module parameters. |
| 90 for (int i = 0; i < scope->num_parameters(); ++i) { | 96 for (int i = 0; i < scope->num_parameters(); ++i) { |
| 91 Variable* param = scope->parameter(i); | 97 Variable* param = scope->parameter(i); |
| 92 DCHECK(GetType(param) == nullptr); | 98 DCHECK(GetType(param) == nullptr); |
| 93 SetType(param, Type::None()); | 99 SetType(param, Type::None()); |
| 94 } | 100 } |
| 95 | 101 |
| 96 ZoneList<Declaration*>* decls = scope->declarations(); | 102 ZoneList<Declaration*>* decls = scope->declarations(); |
| 97 | 103 |
| 98 // Set all globals to type Any. | 104 // Set all globals to type Any. |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 } | 1667 } |
| 1662 | 1668 |
| 1663 | 1669 |
| 1664 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { | 1670 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { |
| 1665 RECURSE(Visit(expr->expression())); | 1671 RECURSE(Visit(expr->expression())); |
| 1666 } | 1672 } |
| 1667 | 1673 |
| 1668 | 1674 |
| 1669 } // namespace internal | 1675 } // namespace internal |
| 1670 } // namespace v8 | 1676 } // namespace v8 |
| OLD | NEW |