Chromium Code Reviews

Side by Side Diff: src/ast/ast.cc

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Use constructor name if available. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 #include "src/ast/ast.h" 5 #include "src/ast/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 8
9 #include "src/ast/compile-time-value.h" 9 #include "src/ast/compile-time-value.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 235 matching lines...)
246 LanguageMode language_mode, 246 LanguageMode language_mode,
247 FeedbackSlot* out_slot) { 247 FeedbackSlot* out_slot) {
248 Property* property = expr->AsProperty(); 248 Property* property = expr->AsProperty();
249 LhsKind assign_type = Property::GetAssignType(property); 249 LhsKind assign_type = Property::GetAssignType(property);
250 if ((assign_type == VARIABLE && 250 if ((assign_type == VARIABLE &&
251 expr->AsVariableProxy()->var()->IsUnallocated()) || 251 expr->AsVariableProxy()->var()->IsUnallocated()) ||
252 assign_type == NAMED_PROPERTY || assign_type == KEYED_PROPERTY) { 252 assign_type == NAMED_PROPERTY || assign_type == KEYED_PROPERTY) {
253 // TODO(ishell): consider using ICSlotCache for variables here. 253 // TODO(ishell): consider using ICSlotCache for variables here.
254 if (assign_type == KEYED_PROPERTY) { 254 if (assign_type == KEYED_PROPERTY) {
255 *out_slot = spec->AddKeyedStoreICSlot(language_mode); 255 *out_slot = spec->AddKeyedStoreICSlot(language_mode);
256
257 } else { 256 } else {
258 *out_slot = spec->AddStoreICSlot(language_mode); 257 *out_slot = spec->AddStoreICSlot(language_mode);
259 } 258 }
260 } 259 }
261 } 260 }
262 261
263 void ForInStatement::AssignFeedbackSlots(FeedbackVectorSpec* spec, 262 void ForInStatement::AssignFeedbackSlots(FeedbackVectorSpec* spec,
264 LanguageMode language_mode, 263 LanguageMode language_mode,
265 FeedbackSlotCache* cache) { 264 FeedbackSlotCache* cache) {
266 AssignVectorSlots(each(), spec, language_mode, &each_slot_); 265 AssignVectorSlots(each(), spec, language_mode, &each_slot_);
267 for_in_feedback_slot_ = spec->AddGeneralSlot(); 266 for_in_feedback_slot_ = spec->AddGeneralSlot();
268 } 267 }
269 268
270 Assignment::Assignment(Token::Value op, Expression* target, Expression* value, 269 Assignment::Assignment(Token::Value op, Expression* target, Expression* value,
271 int pos) 270 int pos)
272 : Expression(pos, kAssignment), 271 : Expression(pos, kAssignment),
273 target_(target), 272 target_(target),
274 value_(value), 273 value_(value),
275 binary_operation_(NULL) { 274 binary_operation_(NULL) {
276 bit_field_ |= IsUninitializedField::encode(false) | 275 bit_field_ |= IsUninitializedField::encode(false) |
277 KeyTypeField::encode(ELEMENT) | 276 KeyTypeField::encode(ELEMENT) |
278 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op); 277 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op);
279 } 278 }
280 279
281 void Assignment::AssignFeedbackSlots(FeedbackVectorSpec* spec, 280 void Assignment::AssignFeedbackSlots(FeedbackVectorSpec* spec,
282 LanguageMode language_mode, 281 LanguageMode language_mode,
283 FeedbackSlotCache* cache) { 282 FeedbackSlotCache* cache) {
284 AssignVectorSlots(target(), spec, language_mode, &slot_); 283 AssignVectorSlots(target(), spec, language_mode, &slot_);
284 if (true || FLAG_type_profile) {
285 collect_type_profile_slot_ = spec->AddTypeProfileSlot();
286 }
285 } 287 }
286 288
287 void CountOperation::AssignFeedbackSlots(FeedbackVectorSpec* spec, 289 void CountOperation::AssignFeedbackSlots(FeedbackVectorSpec* spec,
288 LanguageMode language_mode, 290 LanguageMode language_mode,
289 FeedbackSlotCache* cache) { 291 FeedbackSlotCache* cache) {
290 AssignVectorSlots(expression(), spec, language_mode, &slot_); 292 AssignVectorSlots(expression(), spec, language_mode, &slot_);
291 // Assign a slot to collect feedback about binary operations. Used only in 293 // Assign a slot to collect feedback about binary operations. Used only in
292 // ignition. Fullcodegen uses AstId to record type feedback. 294 // ignition. Fullcodegen uses AstId to record type feedback.
293 binary_operation_slot_ = spec->AddInterpreterBinaryOpICSlot(); 295 binary_operation_slot_ = spec->AddInterpreterBinaryOpICSlot();
294 } 296 }
(...skipping 811 matching lines...)
1106 #ifdef DEBUG 1108 #ifdef DEBUG
1107 return is_jsruntime() ? NameForNativeContextIntrinsicIndex(context_index_) 1109 return is_jsruntime() ? NameForNativeContextIntrinsicIndex(context_index_)
1108 : function_->name; 1110 : function_->name;
1109 #else 1111 #else
1110 return is_jsruntime() ? "(context function)" : function_->name; 1112 return is_jsruntime() ? "(context function)" : function_->name;
1111 #endif // DEBUG 1113 #endif // DEBUG
1112 } 1114 }
1113 1115
1114 } // namespace internal 1116 } // namespace internal
1115 } // namespace v8 1117 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | src/feedback-vector-inl.h » ('J')

Powered by Google App Engine