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 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4001 | 4001 |
4002 Expression* extends = NULL; | 4002 Expression* extends = NULL; |
4003 if (Check(Token::EXTENDS)) { | 4003 if (Check(Token::EXTENDS)) { |
4004 block_scope->set_start_position(scanner()->location().end_pos); | 4004 block_scope->set_start_position(scanner()->location().end_pos); |
4005 extends = ParseLeftHandSideExpression(CHECK_OK); | 4005 extends = ParseLeftHandSideExpression(CHECK_OK); |
4006 } else { | 4006 } else { |
4007 block_scope->set_start_position(scanner()->location().end_pos); | 4007 block_scope->set_start_position(scanner()->location().end_pos); |
4008 } | 4008 } |
4009 | 4009 |
4010 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); | 4010 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); |
4011 Expression* constructor = NULL; | 4011 FunctionLiteral* constructor = NULL; |
4012 bool has_seen_constructor = false; | 4012 bool has_seen_constructor = false; |
4013 | 4013 |
4014 Expect(Token::LBRACE, CHECK_OK); | 4014 Expect(Token::LBRACE, CHECK_OK); |
4015 while (peek() != Token::RBRACE) { | 4015 while (peek() != Token::RBRACE) { |
4016 if (Check(Token::SEMICOLON)) continue; | 4016 if (Check(Token::SEMICOLON)) continue; |
4017 if (fni_ != NULL) fni_->Enter(); | 4017 if (fni_ != NULL) fni_->Enter(); |
4018 const bool in_class = true; | 4018 const bool in_class = true; |
4019 const bool is_static = false; | 4019 const bool is_static = false; |
4020 bool is_computed_name = false; // Classes do not care about computed | 4020 bool is_computed_name = false; // Classes do not care about computed |
4021 // property names here. | 4021 // property names here. |
4022 ObjectLiteral::Property* property = | 4022 ObjectLiteral::Property* property = |
4023 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, | 4023 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, |
4024 &has_seen_constructor, CHECK_OK); | 4024 &has_seen_constructor, CHECK_OK); |
4025 | 4025 |
4026 if (has_seen_constructor && constructor == NULL) { | 4026 if (has_seen_constructor && constructor == NULL) { |
4027 constructor = GetPropertyValue(property); | 4027 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
| 4028 DCHECK_NOT_NULL(constructor); |
4028 } else { | 4029 } else { |
4029 properties->Add(property, zone()); | 4030 properties->Add(property, zone()); |
4030 } | 4031 } |
4031 | 4032 |
4032 if (fni_ != NULL) { | 4033 if (fni_ != NULL) { |
4033 fni_->Infer(); | 4034 fni_->Infer(); |
4034 fni_->Leave(); | 4035 fni_->Leave(); |
4035 } | 4036 } |
4036 } | 4037 } |
4037 | 4038 |
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5340 } else { | 5341 } else { |
5341 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5342 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5342 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5343 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5343 raw_string->length()); | 5344 raw_string->length()); |
5344 } | 5345 } |
5345 } | 5346 } |
5346 | 5347 |
5347 return running_hash; | 5348 return running_hash; |
5348 } | 5349 } |
5349 } } // namespace v8::internal | 5350 } } // namespace v8::internal |
OLD | NEW |