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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2747383004: Revert of Collect type profile for DevTools. (Closed)
Patch Set: Created 3 years, 9 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 2207 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
2208 Register object, key; 2208 Register object, key;
2209 RegisterList super_property_args; 2209 RegisterList super_property_args;
2210 const AstRawString* name; 2210 const AstRawString* name;
2211 2211
2212 // Left-hand side can only be a property, a global or a variable slot. 2212 // Left-hand side can only be a property, a global or a variable slot.
2213 Property* property = expr->target()->AsProperty(); 2213 Property* property = expr->target()->AsProperty();
2214 LhsKind assign_type = Property::GetAssignType(property); 2214 LhsKind assign_type = Property::GetAssignType(property);
2215 2215
2216 // Evaluate LHS expression. 2216 // Evaluate LHS expression.
2217 Register lhs_name;
2218 if (expr->HasTypeProfileSlot()) {
2219 lhs_name = register_allocator()->NewRegister();
2220 }
2221
2222 switch (assign_type) { 2217 switch (assign_type) {
2223 case VARIABLE: 2218 case VARIABLE:
2224 if (expr->HasTypeProfileSlot()) {
2225 builder()
2226 ->LoadLiteral(expr->target()->AsVariableProxy()->var()->raw_name())
2227 .StoreAccumulatorInRegister(lhs_name);
2228 }
2229 // Nothing to do to evaluate variable assignment LHS. 2219 // Nothing to do to evaluate variable assignment LHS.
2230 break; 2220 break;
2231 case NAMED_PROPERTY: { 2221 case NAMED_PROPERTY: {
2232 object = VisitForRegisterValue(property->obj()); 2222 object = VisitForRegisterValue(property->obj());
2233 name = property->key()->AsLiteral()->AsRawPropertyName(); 2223 name = property->key()->AsLiteral()->AsRawPropertyName();
2234 if (expr->HasTypeProfileSlot()) {
2235 builder()->LoadLiteral(name).StoreAccumulatorInRegister(lhs_name);
2236 }
2237 break; 2224 break;
2238 } 2225 }
2239 case KEYED_PROPERTY: { 2226 case KEYED_PROPERTY: {
2240 object = VisitForRegisterValue(property->obj()); 2227 object = VisitForRegisterValue(property->obj());
2241 key = VisitForRegisterValue(property->key()); 2228 key = VisitForRegisterValue(property->key());
2242 if (expr->HasTypeProfileSlot()) {
2243 builder()->StoreAccumulatorInRegister(lhs_name);
2244 }
2245 break; 2229 break;
2246 } 2230 }
2247 case NAMED_SUPER_PROPERTY: { 2231 case NAMED_SUPER_PROPERTY: {
2248 super_property_args = register_allocator()->NewRegisterList(4); 2232 super_property_args = register_allocator()->NewRegisterList(4);
2249 SuperPropertyReference* super_property = 2233 SuperPropertyReference* super_property =
2250 property->obj()->AsSuperPropertyReference(); 2234 property->obj()->AsSuperPropertyReference();
2251 VisitForRegisterValue(super_property->this_var(), super_property_args[0]); 2235 VisitForRegisterValue(super_property->this_var(), super_property_args[0]);
2252 VisitForRegisterValue(super_property->home_object(), 2236 VisitForRegisterValue(super_property->home_object(),
2253 super_property_args[1]); 2237 super_property_args[1]);
2254 builder() 2238 builder()
2255 ->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName()) 2239 ->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName())
2256 .StoreAccumulatorInRegister(super_property_args[2]); 2240 .StoreAccumulatorInRegister(super_property_args[2]);
2257 if (expr->HasTypeProfileSlot()) {
2258 builder()->StoreAccumulatorInRegister(lhs_name);
2259 }
2260 break; 2241 break;
2261 } 2242 }
2262 case KEYED_SUPER_PROPERTY: { 2243 case KEYED_SUPER_PROPERTY: {
2263 super_property_args = register_allocator()->NewRegisterList(4); 2244 super_property_args = register_allocator()->NewRegisterList(4);
2264 SuperPropertyReference* super_property = 2245 SuperPropertyReference* super_property =
2265 property->obj()->AsSuperPropertyReference(); 2246 property->obj()->AsSuperPropertyReference();
2266 VisitForRegisterValue(super_property->this_var(), super_property_args[0]); 2247 VisitForRegisterValue(super_property->this_var(), super_property_args[0]);
2267 VisitForRegisterValue(super_property->home_object(), 2248 VisitForRegisterValue(super_property->home_object(),
2268 super_property_args[1]); 2249 super_property_args[1]);
2269 VisitForRegisterValue(property->key(), super_property_args[2]); 2250 VisitForRegisterValue(property->key(), super_property_args[2]);
2270 if (expr->HasTypeProfileSlot()) {
2271 builder()->StoreAccumulatorInRegister(lhs_name);
2272 }
2273
2274 break; 2251 break;
2275 } 2252 }
2276 } 2253 }
2277 2254
2278 // Evaluate the value and potentially handle compound assignments by loading 2255 // Evaluate the value and potentially handle compound assignments by loading
2279 // the left-hand side value and performing a binary operation. 2256 // the left-hand side value and performing a binary operation.
2280 if (expr->is_compound()) { 2257 if (expr->is_compound()) {
2281 Register old_value = register_allocator()->NewRegister(); 2258 Register old_value = register_allocator()->NewRegister();
2282 switch (assign_type) { 2259 switch (assign_type) {
2283 case VARIABLE: { 2260 case VARIABLE: {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 .CallRuntime(StoreToSuperRuntimeId(), super_property_args); 2329 .CallRuntime(StoreToSuperRuntimeId(), super_property_args);
2353 break; 2330 break;
2354 } 2331 }
2355 case KEYED_SUPER_PROPERTY: { 2332 case KEYED_SUPER_PROPERTY: {
2356 builder() 2333 builder()
2357 ->StoreAccumulatorInRegister(super_property_args[3]) 2334 ->StoreAccumulatorInRegister(super_property_args[3])
2358 .CallRuntime(StoreKeyedToSuperRuntimeId(), super_property_args); 2335 .CallRuntime(StoreKeyedToSuperRuntimeId(), super_property_args);
2359 break; 2336 break;
2360 } 2337 }
2361 } 2338 }
2362
2363 // Value is in accumulator.
2364 if (expr->HasTypeProfileSlot()) {
2365 FeedbackSlot collect_type_feedback_slot = expr->TypeProfileSlot();
2366
2367 builder()->CollectTypeProfile(lhs_name,
2368 feedback_index(collect_type_feedback_slot));
2369 }
2370 } 2339 }
2371 2340
2372 void BytecodeGenerator::VisitYield(Yield* expr) { 2341 void BytecodeGenerator::VisitYield(Yield* expr) {
2373 builder()->SetExpressionPosition(expr); 2342 builder()->SetExpressionPosition(expr);
2374 Register value = VisitForRegisterValue(expr->expression()); 2343 Register value = VisitForRegisterValue(expr->expression());
2375 2344
2376 Register generator = VisitForRegisterValue(expr->generator_object()); 2345 Register generator = VisitForRegisterValue(expr->generator_object());
2377 2346
2378 // Save context, registers, and state. Then return. 2347 // Save context, registers, and state. Then return.
2379 builder() 2348 builder()
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3502 } 3471 }
3503 3472
3504 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3473 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3505 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3474 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3506 : Runtime::kStoreKeyedToSuper_Sloppy; 3475 : Runtime::kStoreKeyedToSuper_Sloppy;
3507 } 3476 }
3508 3477
3509 } // namespace interpreter 3478 } // namespace interpreter
3510 } // namespace internal 3479 } // namespace internal
3511 } // namespace v8 3480 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698