Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 4115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4126 Runtime::FunctionForId(Runtime::kThrowConstructorNonCallableError), | 4126 Runtime::FunctionForId(Runtime::kThrowConstructorNonCallableError), |
| 4127 arguments, pos); | 4127 arguments, pos); |
| 4128 IfStatement* if_statement = factory()->NewIfStatement( | 4128 IfStatement* if_statement = factory()->NewIfStatement( |
| 4129 factory()->NewUnaryOperation(Token::NOT, construct_check, pos), | 4129 factory()->NewUnaryOperation(Token::NOT, construct_check, pos), |
| 4130 factory()->NewReturnStatement(non_callable_error, pos), | 4130 factory()->NewReturnStatement(non_callable_error, pos), |
| 4131 factory()->NewEmptyStatement(pos), pos); | 4131 factory()->NewEmptyStatement(pos), pos); |
| 4132 body->Add(if_statement, zone()); | 4132 body->Add(if_statement, zone()); |
| 4133 } | 4133 } |
| 4134 | 4134 |
| 4135 | 4135 |
| 4136 Statement* Parser::BuildAssertIsCoercible(Variable* var) { | |
| 4137 // if (var === null || var === undefined || %_IsUndetectableObject(var)) | |
|
arv (Not doing code reviews)
2015/05/18 13:12:53
Is this right? Why can I not do?
let {someId} = d
Dmitry Lomov (no reviews)
2015/05/18 13:41:46
The truth is, I have just copied logic from CHECK_
| |
| 4138 // return %ThrowNonCoercible(var); | |
| 4139 | |
| 4140 ZoneList<Expression*>* non_coercible_arguments = | |
| 4141 new (zone()) ZoneList<Expression*>(0, zone()); | |
| 4142 ZoneList<Expression*>* is_undetectable_arguments = | |
| 4143 new (zone()) ZoneList<Expression*>(1, zone()); | |
| 4144 is_undetectable_arguments->Add(factory()->NewVariableProxy(var), zone()); | |
| 4145 Expression* condition = factory()->NewBinaryOperation( | |
| 4146 Token::OR, | |
| 4147 factory()->NewBinaryOperation( | |
| 4148 Token::OR, factory()->NewCompareOperation( | |
| 4149 Token::EQ_STRICT, factory()->NewVariableProxy(var), | |
| 4150 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), | |
| 4151 RelocInfo::kNoPosition), | |
| 4152 factory()->NewCompareOperation( | |
| 4153 Token::EQ_STRICT, factory()->NewVariableProxy(var), | |
| 4154 factory()->NewNullLiteral(RelocInfo::kNoPosition), | |
| 4155 RelocInfo::kNoPosition), | |
| 4156 RelocInfo::kNoPosition), | |
| 4157 factory()->NewCallRuntime( | |
| 4158 ast_value_factory()->empty_string(), | |
| 4159 Runtime::FunctionForId(Runtime::kInlineIsUndetectableObject), | |
| 4160 is_undetectable_arguments, RelocInfo::kNoPosition), | |
| 4161 RelocInfo::kNoPosition); | |
| 4162 CallRuntime* non_callable_error = factory()->NewCallRuntime( | |
| 4163 ast_value_factory()->empty_string(), | |
| 4164 Runtime::FunctionForId(Runtime::kThrowNonCoercible), | |
| 4165 non_coercible_arguments, RelocInfo::kNoPosition); | |
| 4166 IfStatement* if_statement = factory()->NewIfStatement( | |
| 4167 condition, | |
| 4168 factory()->NewReturnStatement(non_callable_error, RelocInfo::kNoPosition), | |
| 4169 factory()->NewEmptyStatement(RelocInfo::kNoPosition), | |
| 4170 RelocInfo::kNoPosition); | |
| 4171 return if_statement; | |
| 4172 } | |
| 4173 | |
| 4174 | |
| 4136 ZoneList<Statement*>* Parser::ParseEagerFunctionBody( | 4175 ZoneList<Statement*>* Parser::ParseEagerFunctionBody( |
| 4137 const AstRawString* function_name, int pos, Variable* fvar, | 4176 const AstRawString* function_name, int pos, Variable* fvar, |
| 4138 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 4177 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
| 4139 // Everything inside an eagerly parsed function will be parsed eagerly | 4178 // Everything inside an eagerly parsed function will be parsed eagerly |
| 4140 // (see comment above). | 4179 // (see comment above). |
| 4141 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 4180 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
| 4142 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8, zone()); | 4181 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8, zone()); |
| 4143 if (fvar != NULL) { | 4182 if (fvar != NULL) { |
| 4144 VariableProxy* fproxy = scope_->NewUnresolved(factory(), function_name); | 4183 VariableProxy* fproxy = scope_->NewUnresolved(factory(), function_name); |
| 4145 fproxy->BindTo(fvar); | 4184 fproxy->BindTo(fvar); |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5748 | 5787 |
| 5749 Expression* Parser::SpreadCallNew(Expression* function, | 5788 Expression* Parser::SpreadCallNew(Expression* function, |
| 5750 ZoneList<v8::internal::Expression*>* args, | 5789 ZoneList<v8::internal::Expression*>* args, |
| 5751 int pos) { | 5790 int pos) { |
| 5752 args->InsertAt(0, function, zone()); | 5791 args->InsertAt(0, function, zone()); |
| 5753 | 5792 |
| 5754 return factory()->NewCallRuntime( | 5793 return factory()->NewCallRuntime( |
| 5755 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5794 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5756 } | 5795 } |
| 5757 } } // namespace v8::internal | 5796 } } // namespace v8::internal |
| OLD | NEW |