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

Side by Side Diff: src/objects-inl.h

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: We still generated the arrays with feature flag off. Fixed. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 void JSObject::ValidateElements() { 1292 void JSObject::ValidateElements() {
1293 #if DEBUG 1293 #if DEBUG
1294 if (FLAG_enable_slow_asserts) { 1294 if (FLAG_enable_slow_asserts) {
1295 ElementsAccessor* accessor = GetElementsAccessor(); 1295 ElementsAccessor* accessor = GetElementsAccessor();
1296 accessor->Validate(this); 1296 accessor->Validate(this);
1297 } 1297 }
1298 #endif 1298 #endif
1299 } 1299 }
1300 1300
1301 1301
1302 bool JSObject::ShouldTrackAllocationInfo() {
1303 if (map()->CanTrackAllocationSite()) {
1304 if (!IsJSArray()) {
1305 return true;
1306 }
1307
1308 return AllocationSiteInfo::GetMode(GetElementsKind()) ==
1309 TRACK_ALLOCATION_SITE;
1310 }
1311 return false;
1312 }
1313
1314
1315 // Heuristic: We only need to create allocation site info if the boilerplate
1316 // elements kind is the initial elements kind.
1317 AllocationSiteMode AllocationSiteInfo::GetMode(
1318 ElementsKind boilerplate_elements_kind) {
1319 if (FLAG_track_allocation_sites &&
1320 IsFastSmiElementsKind(boilerplate_elements_kind)) {
1321 return TRACK_ALLOCATION_SITE;
1322 }
1323
1324 return DONT_TRACK_ALLOCATION_SITE;
1325 }
1326
1327
1328 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
1329 ElementsKind to) {
1330 if (FLAG_track_allocation_sites &&
1331 IsFastSmiElementsKind(from) &&
1332 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
1333 return TRACK_ALLOCATION_SITE;
1334 }
1335
1336 return DONT_TRACK_ALLOCATION_SITE;
1337 }
1338
1339
1302 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { 1340 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() {
1303 ValidateElements(); 1341 ValidateElements();
1304 ElementsKind elements_kind = map()->elements_kind(); 1342 ElementsKind elements_kind = map()->elements_kind();
1305 if (!IsFastObjectElementsKind(elements_kind)) { 1343 if (!IsFastObjectElementsKind(elements_kind)) {
1306 if (IsFastHoleyElementsKind(elements_kind)) { 1344 if (IsFastHoleyElementsKind(elements_kind)) {
1307 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); 1345 return TransitionElementsKind(FAST_HOLEY_ELEMENTS);
1308 } else { 1346 } else {
1309 return TransitionElementsKind(FAST_ELEMENTS); 1347 return TransitionElementsKind(FAST_ELEMENTS);
1310 } 1348 }
1311 } 1349 }
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 kind() == KEYED_STORE_IC || 3720 kind() == KEYED_STORE_IC ||
3683 kind() == TO_BOOLEAN_IC); 3721 kind() == TO_BOOLEAN_IC);
3684 ASSERT(0 <= major && major < 256); 3722 ASSERT(0 <= major && major < 256);
3685 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); 3723 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3686 int updated = StubMajorKeyField::update(previous, major); 3724 int updated = StubMajorKeyField::update(previous, major);
3687 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); 3725 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3688 } 3726 }
3689 3727
3690 3728
3691 bool Code::is_pregenerated() { 3729 bool Code::is_pregenerated() {
3692 return kind() == STUB && IsPregeneratedField::decode(flags()); 3730 return (kind() == STUB && IsPregeneratedField::decode(flags()));
3693 } 3731 }
3694 3732
3695 3733
3696 void Code::set_is_pregenerated(bool value) { 3734 void Code::set_is_pregenerated(bool value) {
3697 ASSERT(kind() == STUB); 3735 ASSERT(kind() == STUB);
3698 Flags f = flags(); 3736 Flags f = flags();
3699 f = static_cast<Flags>(IsPregeneratedField::update(f, value)); 3737 f = static_cast<Flags>(IsPregeneratedField::update(f, value));
3700 set_flags(f); 3738 set_flags(f);
3701 } 3739 }
3702 3740
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
6119 #undef WRITE_UINT32_FIELD 6157 #undef WRITE_UINT32_FIELD
6120 #undef READ_SHORT_FIELD 6158 #undef READ_SHORT_FIELD
6121 #undef WRITE_SHORT_FIELD 6159 #undef WRITE_SHORT_FIELD
6122 #undef READ_BYTE_FIELD 6160 #undef READ_BYTE_FIELD
6123 #undef WRITE_BYTE_FIELD 6161 #undef WRITE_BYTE_FIELD
6124 6162
6125 6163
6126 } } // namespace v8::internal 6164 } } // namespace v8::internal
6127 6165
6128 #endif // V8_OBJECTS_INL_H_ 6166 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698