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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 body = new (zone()) ZoneList<Statement*>(1, zone()); | 295 body = new (zone()) ZoneList<Statement*>(1, zone()); |
296 if (call_super) { | 296 if (call_super) { |
297 ZoneList<Expression*>* args = | 297 ZoneList<Expression*>* args = |
298 new (zone()) ZoneList<Expression*>(0, zone()); | 298 new (zone()) ZoneList<Expression*>(0, zone()); |
299 CallRuntime* call = factory()->NewCallRuntime( | 299 CallRuntime* call = factory()->NewCallRuntime( |
300 ast_value_factory()->empty_string(), | 300 ast_value_factory()->empty_string(), |
301 Runtime::FunctionForId(Runtime::kDefaultConstructorSuperCall), args, | 301 Runtime::FunctionForId(Runtime::kDefaultConstructorSuperCall), args, |
302 pos); | 302 pos); |
303 body->Add(factory()->NewExpressionStatement(call, pos), zone()); | 303 body->Add(factory()->NewExpressionStatement(call, pos), zone()); |
304 function_scope->RecordSuperUsage(); | 304 function_scope->RecordSuperConstructorCallUsage(); |
305 } | 305 } |
306 | 306 |
307 materialized_literal_count = function_state.materialized_literal_count(); | 307 materialized_literal_count = function_state.materialized_literal_count(); |
308 expected_property_count = function_state.expected_property_count(); | 308 expected_property_count = function_state.expected_property_count(); |
309 handler_count = function_state.handler_count(); | 309 handler_count = function_state.handler_count(); |
310 } | 310 } |
311 | 311 |
312 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( | 312 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( |
313 name, ast_value_factory(), function_scope, body, | 313 name, ast_value_factory(), function_scope, body, |
314 materialized_literal_count, expected_property_count, handler_count, | 314 materialized_literal_count, expected_property_count, handler_count, |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 ? FunctionLiteral::ANONYMOUS_EXPRESSION | 1046 ? FunctionLiteral::ANONYMOUS_EXPRESSION |
1047 : FunctionLiteral::NAMED_EXPRESSION) | 1047 : FunctionLiteral::NAMED_EXPRESSION) |
1048 : FunctionLiteral::DECLARATION; | 1048 : FunctionLiteral::DECLARATION; |
1049 bool ok = true; | 1049 bool ok = true; |
1050 | 1050 |
1051 if (shared_info->is_arrow()) { | 1051 if (shared_info->is_arrow()) { |
1052 Expression* expression = ParseExpression(false, &ok); | 1052 Expression* expression = ParseExpression(false, &ok); |
1053 DCHECK(expression->IsFunctionLiteral()); | 1053 DCHECK(expression->IsFunctionLiteral()); |
1054 result = expression->AsFunctionLiteral(); | 1054 result = expression->AsFunctionLiteral(); |
1055 } else if (shared_info->is_default_constructor()) { | 1055 } else if (shared_info->is_default_constructor()) { |
1056 result = DefaultConstructor(shared_info->uses_super(), scope, | 1056 result = DefaultConstructor(shared_info->uses_super_constructor_call(), |
1057 shared_info->start_position(), | 1057 scope, shared_info->start_position(), |
1058 shared_info->end_position()); | 1058 shared_info->end_position()); |
1059 } else { | 1059 } else { |
1060 result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(), | 1060 result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(), |
1061 false, // Strict mode name already checked. | 1061 false, // Strict mode name already checked. |
1062 shared_info->kind(), RelocInfo::kNoPosition, | 1062 shared_info->kind(), RelocInfo::kNoPosition, |
1063 function_type, | 1063 function_type, |
1064 FunctionLiteral::NORMAL_ARITY, &ok); | 1064 FunctionLiteral::NORMAL_ARITY, &ok); |
1065 } | 1065 } |
1066 // Make sure the results agree. | 1066 // Make sure the results agree. |
1067 DCHECK(ok == (result != NULL)); | 1067 DCHECK(ok == (result != NULL)); |
(...skipping 4280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5348 } | 5348 } |
5349 | 5349 |
5350 // Hash key is used exclusively by template call site caching. There are no | 5350 // Hash key is used exclusively by template call site caching. There are no |
5351 // real security implications for unseeded hashes, and no issues with changing | 5351 // real security implications for unseeded hashes, and no issues with changing |
5352 // the hashing algorithm to improve performance or entropy. | 5352 // the hashing algorithm to improve performance or entropy. |
5353 *hash = running_hash; | 5353 *hash = running_hash; |
5354 | 5354 |
5355 return raw_strings; | 5355 return raw_strings; |
5356 } | 5356 } |
5357 } } // namespace v8::internal | 5357 } } // namespace v8::internal |
OLD | NEW |