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

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: More efficient code when number of arguments is known 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
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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 void JSObject::ValidateElements() { 1290 void JSObject::ValidateElements() {
1291 #if DEBUG 1291 #if DEBUG
1292 if (FLAG_enable_slow_asserts) { 1292 if (FLAG_enable_slow_asserts) {
1293 ElementsAccessor* accessor = GetElementsAccessor(); 1293 ElementsAccessor* accessor = GetElementsAccessor();
1294 accessor->Validate(this); 1294 accessor->Validate(this);
1295 } 1295 }
1296 #endif 1296 #endif
1297 } 1297 }
1298 1298
1299 1299
1300 bool JSObject::ShouldTrackAllocationInfo() {
1301 if (map()->CanTrackAllocationSite()) {
1302 if (!IsJSArray()) {
1303 return true;
1304 }
1305
1306 return AllocationSiteInfo::GetMode(GetElementsKind()) ==
1307 TRACK_ALLOCATION_SITE;
1308 }
1309 return false;
1310 }
1311
1312
1313 // Heuristic: We only need to create allocation site info if the boilerplate
1314 // elements kind is the initial elements kind.
1315 AllocationSiteMode AllocationSiteInfo::GetMode(
1316 ElementsKind boilerplate_elements_kind) {
1317 if (FLAG_track_allocation_sites &&
1318 IsFastSmiElementsKind(boilerplate_elements_kind)) {
1319 return TRACK_ALLOCATION_SITE;
1320 }
1321
1322 return DONT_TRACK_ALLOCATION_SITE;
1323 }
1324
1325
1326 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
1327 ElementsKind to) {
1328 if (FLAG_track_allocation_sites &&
1329 IsFastSmiElementsKind(from) &&
1330 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
1331 return TRACK_ALLOCATION_SITE;
1332 }
1333
1334 return DONT_TRACK_ALLOCATION_SITE;
1335 }
1336
1337
1300 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { 1338 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() {
1301 ValidateElements(); 1339 ValidateElements();
1302 ElementsKind elements_kind = map()->elements_kind(); 1340 ElementsKind elements_kind = map()->elements_kind();
1303 if (!IsFastObjectElementsKind(elements_kind)) { 1341 if (!IsFastObjectElementsKind(elements_kind)) {
1304 if (IsFastHoleyElementsKind(elements_kind)) { 1342 if (IsFastHoleyElementsKind(elements_kind)) {
1305 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); 1343 return TransitionElementsKind(FAST_HOLEY_ELEMENTS);
1306 } else { 1344 } else {
1307 return TransitionElementsKind(FAST_ELEMENTS); 1345 return TransitionElementsKind(FAST_ELEMENTS);
1308 } 1346 }
1309 } 1347 }
(...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 kind() == KEYED_STORE_IC || 3702 kind() == KEYED_STORE_IC ||
3665 kind() == TO_BOOLEAN_IC); 3703 kind() == TO_BOOLEAN_IC);
3666 ASSERT(0 <= major && major < 256); 3704 ASSERT(0 <= major && major < 256);
3667 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); 3705 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
3668 int updated = StubMajorKeyField::update(previous, major); 3706 int updated = StubMajorKeyField::update(previous, major);
3669 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); 3707 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated);
3670 } 3708 }
3671 3709
3672 3710
3673 bool Code::is_pregenerated() { 3711 bool Code::is_pregenerated() {
3674 return kind() == STUB && IsPregeneratedField::decode(flags()); 3712 return (kind() == STUB || kind() == COMPILED_STUB)
3713 && IsPregeneratedField::decode(flags());
3675 } 3714 }
3676 3715
3677 3716
3678 void Code::set_is_pregenerated(bool value) { 3717 void Code::set_is_pregenerated(bool value) {
3679 ASSERT(kind() == STUB); 3718 ASSERT(kind() == STUB || kind() == COMPILED_STUB);
3680 Flags f = flags(); 3719 Flags f = flags();
3681 f = static_cast<Flags>(IsPregeneratedField::update(f, value)); 3720 f = static_cast<Flags>(IsPregeneratedField::update(f, value));
3682 set_flags(f); 3721 set_flags(f);
3683 } 3722 }
3684 3723
3685 3724
3686 bool Code::optimizable() { 3725 bool Code::optimizable() {
3687 ASSERT_EQ(FUNCTION, kind()); 3726 ASSERT_EQ(FUNCTION, kind());
3688 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; 3727 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
3689 } 3728 }
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after
6082 #undef WRITE_UINT32_FIELD 6121 #undef WRITE_UINT32_FIELD
6083 #undef READ_SHORT_FIELD 6122 #undef READ_SHORT_FIELD
6084 #undef WRITE_SHORT_FIELD 6123 #undef WRITE_SHORT_FIELD
6085 #undef READ_BYTE_FIELD 6124 #undef READ_BYTE_FIELD
6086 #undef WRITE_BYTE_FIELD 6125 #undef WRITE_BYTE_FIELD
6087 6126
6088 6127
6089 } } // namespace v8::internal 6128 } } // namespace v8::internal
6090 6129
6091 #endif // V8_OBJECTS_INL_H_ 6130 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698