Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Side by Side Diff: src/preparser.h

Issue 858673002: Fix issue with __proto__ when using ES6 object literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/object-literals-method.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef V8_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 PreParserIdentifier js_flags, 1042 PreParserIdentifier js_flags,
1043 int literal_index, 1043 int literal_index,
1044 int pos) { 1044 int pos) {
1045 return PreParserExpression::Default(); 1045 return PreParserExpression::Default();
1046 } 1046 }
1047 PreParserExpression NewArrayLiteral(PreParserExpressionList values, 1047 PreParserExpression NewArrayLiteral(PreParserExpressionList values,
1048 int literal_index, 1048 int literal_index,
1049 int pos) { 1049 int pos) {
1050 return PreParserExpression::Default(); 1050 return PreParserExpression::Default();
1051 } 1051 }
1052 PreParserExpression NewObjectLiteralProperty(bool is_getter, 1052 PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
1053 PreParserExpression key,
1054 PreParserExpression value, 1053 PreParserExpression value,
1055 int pos, bool is_static, 1054 ObjectLiteralProperty::Kind kind,
1055 bool is_static,
1056 bool is_computed_name) { 1056 bool is_computed_name) {
1057 return PreParserExpression::Default(); 1057 return PreParserExpression::Default();
1058 } 1058 }
1059 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, 1059 PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
1060 PreParserExpression value, 1060 PreParserExpression value,
1061 bool is_static, 1061 bool is_static,
1062 bool is_computed_name) { 1062 bool is_computed_name) {
1063 return PreParserExpression::Default(); 1063 return PreParserExpression::Default();
1064 } 1064 }
1065 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, 1065 PreParserExpression NewObjectLiteral(PreParserExpressionList properties,
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 2134 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
2135 } 2135 }
2136 2136
2137 value = this->ParseFunctionLiteral( 2137 value = this->ParseFunctionLiteral(
2138 name, scanner()->location(), 2138 name, scanner()->location(),
2139 false, // reserved words are allowed here 2139 false, // reserved words are allowed here
2140 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION, 2140 kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION,
2141 FunctionLiteral::NORMAL_ARITY, 2141 FunctionLiteral::NORMAL_ARITY,
2142 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 2142 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
2143 2143
2144 return factory()->NewObjectLiteralProperty(name_expression, value,
2145 ObjectLiteralProperty::COMPUTED,
2146 is_static, *is_computed_name);
2147
2144 } else if (in_class && name_is_static && !is_static) { 2148 } else if (in_class && name_is_static && !is_static) {
2145 // static MethodDefinition 2149 // static MethodDefinition
2146 return ParsePropertyDefinition(checker, true, true, is_computed_name, NULL, 2150 return ParsePropertyDefinition(checker, true, true, is_computed_name, NULL,
2147 ok); 2151 ok);
2148 2152
2149 } else if (is_get || is_set) { 2153 } else if (is_get || is_set) {
2150 // Accessor 2154 // Accessor
2151 name = this->EmptyIdentifier(); 2155 name = this->EmptyIdentifier();
2152 bool dont_care = false; 2156 bool dont_care = false;
2153 name_token = peek(); 2157 name_token = peek();
(...skipping 28 matching lines...) Expand all
2182 2186
2183 // Make sure the name expression is a string since we need a Name for 2187 // Make sure the name expression is a string since we need a Name for
2184 // Runtime_DefineAccessorPropertyUnchecked and since we can determine this 2188 // Runtime_DefineAccessorPropertyUnchecked and since we can determine this
2185 // statically we can skip the extra runtime check. 2189 // statically we can skip the extra runtime check.
2186 if (!*is_computed_name) { 2190 if (!*is_computed_name) {
2187 name_expression = 2191 name_expression =
2188 factory()->NewStringLiteral(name, name_expression->position()); 2192 factory()->NewStringLiteral(name, name_expression->position());
2189 } 2193 }
2190 2194
2191 return factory()->NewObjectLiteralProperty( 2195 return factory()->NewObjectLiteralProperty(
2192 is_get, name_expression, value, next_pos, is_static, *is_computed_name); 2196 name_expression, value,
2197 is_get ? ObjectLiteralProperty::GETTER : ObjectLiteralProperty::SETTER,
2198 is_static, *is_computed_name);
2193 2199
2194 } else if (!in_class && allow_harmony_object_literals_ && 2200 } else if (!in_class && allow_harmony_object_literals_ &&
2195 Token::IsIdentifier(name_token, strict_mode(), 2201 Token::IsIdentifier(name_token, strict_mode(),
2196 this->is_generator())) { 2202 this->is_generator())) {
2203 DCHECK(!*is_computed_name);
2204 DCHECK(!is_static);
2197 value = this->ExpressionFromIdentifier(name, next_pos, scope_, factory()); 2205 value = this->ExpressionFromIdentifier(name, next_pos, scope_, factory());
2206 return factory()->NewObjectLiteralProperty(
2207 name_expression, value, ObjectLiteralProperty::COMPUTED, false, false);
2198 2208
2199 } else { 2209 } else {
2200 Token::Value next = Next(); 2210 Token::Value next = Next();
2201 ReportUnexpectedToken(next); 2211 ReportUnexpectedToken(next);
2202 *ok = false; 2212 *ok = false;
2203 return this->EmptyObjectLiteralProperty(); 2213 return this->EmptyObjectLiteralProperty();
2204 } 2214 }
2205 2215
2206 return factory()->NewObjectLiteralProperty(name_expression, value, is_static, 2216 return factory()->NewObjectLiteralProperty(name_expression, value, is_static,
2207 *is_computed_name); 2217 *is_computed_name);
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 DCHECK(IsAccessorAccessorConflict(old_type, type)); 3056 DCHECK(IsAccessorAccessorConflict(old_type, type));
3047 // Both accessors of the same type. 3057 // Both accessors of the same type.
3048 parser()->ReportMessage("accessor_get_set"); 3058 parser()->ReportMessage("accessor_get_set");
3049 } 3059 }
3050 *ok = false; 3060 *ok = false;
3051 } 3061 }
3052 } 3062 }
3053 } } // v8::internal 3063 } } // v8::internal
3054 3064
3055 #endif // V8_PREPARSER_H 3065 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/object-literals-method.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698