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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 cached_parse_data_ = NULL; | 256 cached_parse_data_ = NULL; |
257 } else { | 257 } else { |
258 DCHECK(info_->cached_data() != NULL); | 258 DCHECK(info_->cached_data() != NULL); |
259 if (compile_options() == ScriptCompiler::kConsumeParserCache) { | 259 if (compile_options() == ScriptCompiler::kConsumeParserCache) { |
260 cached_parse_data_ = ParseData::FromCachedData(*info_->cached_data()); | 260 cached_parse_data_ = ParseData::FromCachedData(*info_->cached_data()); |
261 } | 261 } |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 | 265 |
266 Scope* Parser::NewScope(Scope* parent, ScopeType scope_type, | |
267 FunctionKind kind) { | |
268 DCHECK(ast_value_factory()); | |
269 DCHECK(scope_type != MODULE_SCOPE || allow_harmony_modules()); | |
270 DCHECK((scope_type == FUNCTION_SCOPE && IsValidFunctionKind(kind)) || | |
271 kind == kNormalFunction); | |
272 Scope* result = new (zone()) | |
273 Scope(isolate(), zone(), parent, scope_type, ast_value_factory()); | |
274 bool uninitialized_this = | |
275 FLAG_experimental_classes && IsSubclassConstructor(kind); | |
276 result->Initialize(uninitialized_this); | |
277 return result; | |
278 } | |
279 | |
280 | |
281 FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope, | 266 FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope, |
282 int pos, int end_pos) { | 267 int pos, int end_pos) { |
283 int materialized_literal_count = -1; | 268 int materialized_literal_count = -1; |
284 int expected_property_count = -1; | 269 int expected_property_count = -1; |
285 int handler_count = 0; | 270 int handler_count = 0; |
286 int parameter_count = 0; | 271 int parameter_count = 0; |
287 const AstRawString* name = ast_value_factory()->empty_string(); | 272 const AstRawString* name = ast_value_factory()->empty_string(); |
288 | 273 |
289 Scope* function_scope = | 274 Scope* function_scope = |
290 NewScope(scope, FUNCTION_SCOPE, FunctionKind::kDefaultConstructor); | 275 NewScope(scope, FUNCTION_SCOPE, FunctionKind::kDefaultConstructor); |
(...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5465 } else { | 5450 } else { |
5466 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5451 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5467 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5452 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5468 raw_string->length()); | 5453 raw_string->length()); |
5469 } | 5454 } |
5470 } | 5455 } |
5471 | 5456 |
5472 return running_hash; | 5457 return running_hash; |
5473 } | 5458 } |
5474 } } // namespace v8::internal | 5459 } } // namespace v8::internal |
OLD | NEW |