Index: src/typing-asm.cc |
diff --git a/src/typing-asm.cc b/src/typing-asm.cc |
index 015be1348922319a66e11826d66774253eec3f7c..c14f88fe9ef5b442ae0cdfb21cd1a76a0a5769f5 100644 |
--- a/src/typing-asm.cc |
+++ b/src/typing-asm.cc |
@@ -776,14 +776,14 @@ bool AsmTyper::IsStdlibObject(Expression* expr) { |
Variable* var = proxy->var(); |
VariableInfo* info = GetVariableInfo(var, false); |
if (info) { |
- if (info->is_stdlib_object) return info->is_stdlib_object; |
+ if (info->standard_object == kStdlib) return true; |
} |
if (var->location() != VariableLocation::PARAMETER || var->index() != 0) { |
return false; |
} |
info = GetVariableInfo(var, true); |
info->type = Type::Object(); |
- info->is_stdlib_object = true; |
+ info->standard_object = kStdlib; |
return true; |
} |
@@ -1234,30 +1234,46 @@ void AsmTyper::InitializeStdlib() { |
struct Assignment { |
const char* name; |
+ StandardObject standard_object; |
Type* type; |
}; |
- const Assignment math[] = { |
- {"PI", double_type}, {"E", double_type}, |
- {"LN2", double_type}, {"LN10", double_type}, |
- {"LOG2E", double_type}, {"LOG10E", double_type}, |
- {"SQRT2", double_type}, {"SQRT1_2", double_type}, |
- {"imul", imul_type}, {"abs", abs_type}, |
- {"ceil", double_fn1_type}, {"floor", double_fn1_type}, |
- {"fround", fround_type}, {"pow", double_fn2_type}, |
- {"exp", double_fn1_type}, {"log", double_fn1_type}, |
- {"min", double_fn2_type}, {"max", double_fn2_type}, |
- {"sqrt", double_fn1_type}, {"cos", double_fn1_type}, |
- {"sin", double_fn1_type}, {"tan", double_fn1_type}, |
- {"acos", double_fn1_type}, {"asin", double_fn1_type}, |
- {"atan", double_fn1_type}, {"atan2", double_fn2_type}}; |
+ const Assignment math[] = {{"PI", kMathPI, double_type}, |
+ {"E", kMathE, double_type}, |
+ {"LN2", kMathLN2, double_type}, |
+ {"LN10", kMathLN10, double_type}, |
+ {"LOG2E", kMathLOG2E, double_type}, |
+ {"LOG10E", kMathLOG10E, double_type}, |
+ {"SQRT2", kMathSQRT2, double_type}, |
+ {"SQRT1_2", kMathSQRT1_2, double_type}, |
+ {"imul", kMathImul, imul_type}, |
+ {"abs", kMathAbs, abs_type}, |
+ {"ceil", kMathCeil, double_fn1_type}, |
+ {"floor", kMathFloor, double_fn1_type}, |
+ {"fround", kMathFround, fround_type}, |
+ {"pow", kMathPow, double_fn2_type}, |
+ {"exp", kMathExp, double_fn1_type}, |
+ {"log", kMathLog, double_fn1_type}, |
+ {"min", kMathMin, double_fn2_type}, |
+ {"max", kMathMax, double_fn2_type}, |
+ {"sqrt", kMathSqrt, double_fn1_type}, |
+ {"cos", kMathCos, double_fn1_type}, |
+ {"sin", kMathSin, double_fn1_type}, |
+ {"tan", kMathTan, double_fn1_type}, |
+ {"acos", kMathAcos, double_fn1_type}, |
+ {"asin", kMathAsin, double_fn1_type}, |
+ {"atan", kMathAtan, double_fn1_type}, |
+ {"atan2", kMathAtan2, double_fn2_type}}; |
for (unsigned i = 0; i < arraysize(math); ++i) { |
stdlib_math_types_[math[i].name] = new (zone()) VariableInfo(math[i].type); |
+ stdlib_math_types_[math[i].name]->standard_object = math[i].standard_object; |
} |
stdlib_math_types_["fround"]->is_check_function = true; |
stdlib_types_["Infinity"] = new (zone()) VariableInfo(double_type); |
+ stdlib_types_["Infinity"]->standard_object = kInfinity; |
stdlib_types_["NaN"] = new (zone()) VariableInfo(double_type); |
+ stdlib_types_["NaN"]->standard_object = kNaN; |
Type* buffer_type = Type::Any(zone()); |
#define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ |
stdlib_types_[#TypeName "Array"] = new (zone()) VariableInfo( \ |
@@ -1340,9 +1356,17 @@ AsmTyper::VariableInfo* AsmTyper::GetVariableInfo(Variable* variable, |
void AsmTyper::SetVariableInfo(Variable* variable, const VariableInfo* info) { |
VariableInfo* dest = GetVariableInfo(variable, true); |
dest->type = info->type; |
- dest->is_stdlib_object = info->is_stdlib_object; |
dest->is_check_function = info->is_check_function; |
dest->is_constructor_function = info->is_constructor_function; |
+ dest->standard_object = info->standard_object; |
+} |
+ |
+ |
+AsmTyper::StandardObject AsmTyper::VariableAsStandardObject( |
+ Variable* variable) { |
+ VariableInfo* info = GetVariableInfo(variable, false); |
+ if (!info) return kNone; |
+ return info->standard_object; |
} |