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

Side by Side Diff: src/hydrogen.cc

Issue 15841007: Remove HCheckSmi, LCheckSmi and rename LCheckSmiAndReturn to LCheckSmi. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use ForceRepresentation rather than directly inserting HChange Created 7 years, 6 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/code-stubs-hydrogen.cc ('k') | src/hydrogen-instructions.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 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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 ElementsKind elements_kind, 1092 ElementsKind elements_kind,
1093 bool is_store, 1093 bool is_store,
1094 LoadKeyedHoleMode load_mode, 1094 LoadKeyedHoleMode load_mode,
1095 KeyedAccessStoreMode store_mode) { 1095 KeyedAccessStoreMode store_mode) {
1096 Zone* zone = this->zone(); 1096 Zone* zone = this->zone();
1097 if (is_store) { 1097 if (is_store) {
1098 ASSERT(val != NULL); 1098 ASSERT(val != NULL);
1099 switch (elements_kind) { 1099 switch (elements_kind) {
1100 case FAST_SMI_ELEMENTS: 1100 case FAST_SMI_ELEMENTS:
1101 case FAST_HOLEY_SMI_ELEMENTS: 1101 case FAST_HOLEY_SMI_ELEMENTS:
1102 if (!val->type().IsSmi()) {
1103 // Smi-only arrays need a smi check.
1104 AddInstruction(new(zone) HCheckSmi(val));
1105 }
1106 // Fall through.
1107 case FAST_ELEMENTS: 1102 case FAST_ELEMENTS:
1108 case FAST_HOLEY_ELEMENTS: 1103 case FAST_HOLEY_ELEMENTS:
1109 case FAST_DOUBLE_ELEMENTS: 1104 case FAST_DOUBLE_ELEMENTS:
1110 case FAST_HOLEY_DOUBLE_ELEMENTS: 1105 case FAST_HOLEY_DOUBLE_ELEMENTS:
1111 return new(zone) HStoreKeyed(elements, checked_key, val, elements_kind); 1106 return new(zone) HStoreKeyed(elements, checked_key, val, elements_kind);
1112 default: 1107 default:
1113 UNREACHABLE(); 1108 UNREACHABLE();
1114 return NULL; 1109 return NULL;
1115 } 1110 }
1116 } 1111 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 AddInstruction(external_elements); 1280 AddInstruction(external_elements);
1286 return AddInstruction(BuildExternalArrayElementAccess( 1281 return AddInstruction(BuildExternalArrayElementAccess(
1287 external_elements, checked_key, val, mapcheck, 1282 external_elements, checked_key, val, mapcheck,
1288 elements_kind, is_store)); 1283 elements_kind, is_store));
1289 } 1284 }
1290 } 1285 }
1291 ASSERT(fast_smi_only_elements || 1286 ASSERT(fast_smi_only_elements ||
1292 fast_elements || 1287 fast_elements ||
1293 IsFastDoubleElementsKind(elements_kind)); 1288 IsFastDoubleElementsKind(elements_kind));
1294 1289
1290 // In case val is stored into a fast smi array, assure that the value is a smi
1291 // before manipulating the backing store. Otherwise the actual store may
1292 // deopt, leaving the backing store in an invalid state.
1295 if (is_store && IsFastSmiElementsKind(elements_kind) && 1293 if (is_store && IsFastSmiElementsKind(elements_kind) &&
1296 !val->type().IsSmi()) { 1294 !val->type().IsSmi()) {
1297 AddInstruction(new(zone) HCheckSmi(val)); 1295 val = AddInstruction(new(zone) HForceRepresentation(
1296 val, Representation::Smi()));
1298 } 1297 }
1299 1298
1300 if (IsGrowStoreMode(store_mode)) { 1299 if (IsGrowStoreMode(store_mode)) {
1301 NoObservableSideEffectsScope no_effects(this); 1300 NoObservableSideEffectsScope no_effects(this);
1302
1303 elements = BuildCheckForCapacityGrow(object, elements, elements_kind, 1301 elements = BuildCheckForCapacityGrow(object, elements, elements_kind,
1304 length, key, is_js_array); 1302 length, key, is_js_array);
1305 checked_key = key; 1303 checked_key = key;
1306 } else { 1304 } else {
1307 checked_key = AddBoundsCheck( 1305 checked_key = AddBoundsCheck(
1308 key, length, ALLOW_SMI_KEY, checked_index_representation); 1306 key, length, ALLOW_SMI_KEY, checked_index_representation);
1309 1307
1310 if (is_store && (fast_elements || fast_smi_only_elements)) { 1308 if (is_store && (fast_elements || fast_smi_only_elements)) {
1311 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { 1309 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) {
1312 NoObservableSideEffectsScope no_effects(this); 1310 NoObservableSideEffectsScope no_effects(this);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 constant_from->Integer32Value() == 0 && 1533 constant_from->Integer32Value() == 0 &&
1536 constant_to->HasInteger32Value() && 1534 constant_to->HasInteger32Value() &&
1537 constant_to->Integer32Value() == initial_capacity) { 1535 constant_to->Integer32Value() == initial_capacity) {
1538 unfold_loop = true; 1536 unfold_loop = true;
1539 } 1537 }
1540 } 1538 }
1541 1539
1542 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 1540 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
1543 elements_kind = FAST_HOLEY_ELEMENTS; 1541 elements_kind = FAST_HOLEY_ELEMENTS;
1544 } 1542 }
1543
1545 if (unfold_loop) { 1544 if (unfold_loop) {
1546 for (int i = 0; i < initial_capacity; i++) { 1545 for (int i = 0; i < initial_capacity; i++) {
1547 HInstruction* key = AddInstruction(new(zone) 1546 HInstruction* key = AddInstruction(new(zone)
1548 HConstant(i, Representation::Integer32())); 1547 HConstant(i, Representation::Integer32()));
1549 AddInstruction(new(zone) HStoreKeyed(elements, key, hole, elements_kind)); 1548 AddInstruction(new(zone) HStoreKeyed(elements, key, hole, elements_kind));
1550 } 1549 }
1551 } else { 1550 } else {
1552 LoopBuilder builder(this, context, LoopBuilder::kPostIncrement); 1551 LoopBuilder builder(this, context, LoopBuilder::kPostIncrement);
1553 1552
1554 HValue* key = builder.BeginBody(from, to, Token::LT); 1553 HValue* key = builder.BeginBody(from, to, Token::LT);
(...skipping 5377 matching lines...) Expand 10 before | Expand all | Expand 10 after
6932 6931
6933 elements = AddLoadElements(literal); 6932 elements = AddLoadElements(literal);
6934 6933
6935 HValue* key = AddInstruction( 6934 HValue* key = AddInstruction(
6936 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i), isolate()), 6935 new(zone()) HConstant(Handle<Object>(Smi::FromInt(i), isolate()),
6937 Representation::Integer32())); 6936 Representation::Integer32()));
6938 6937
6939 switch (boilerplate_elements_kind) { 6938 switch (boilerplate_elements_kind) {
6940 case FAST_SMI_ELEMENTS: 6939 case FAST_SMI_ELEMENTS:
6941 case FAST_HOLEY_SMI_ELEMENTS: 6940 case FAST_HOLEY_SMI_ELEMENTS:
6942 if (!value->type().IsSmi()) {
6943 // Smi-only arrays need a smi check.
6944 AddInstruction(new(zone()) HCheckSmi(value));
6945 // Fall through.
6946 }
6947 case FAST_ELEMENTS: 6941 case FAST_ELEMENTS:
6948 case FAST_HOLEY_ELEMENTS: 6942 case FAST_HOLEY_ELEMENTS:
6949 case FAST_DOUBLE_ELEMENTS: 6943 case FAST_DOUBLE_ELEMENTS:
6950 case FAST_HOLEY_DOUBLE_ELEMENTS: 6944 case FAST_HOLEY_DOUBLE_ELEMENTS:
6951 AddInstruction(new(zone()) HStoreKeyed( 6945 AddInstruction(new(zone()) HStoreKeyed(
6952 elements, 6946 elements,
6953 key, 6947 key,
6954 value, 6948 value,
6955 boilerplate_elements_kind)); 6949 boilerplate_elements_kind));
6956 break; 6950 break;
(...skipping 5383 matching lines...) Expand 10 before | Expand all | Expand 10 after
12340 } 12334 }
12341 } 12335 }
12342 12336
12343 #ifdef DEBUG 12337 #ifdef DEBUG
12344 if (graph_ != NULL) graph_->Verify(false); // No full verify. 12338 if (graph_ != NULL) graph_->Verify(false); // No full verify.
12345 if (allocator_ != NULL) allocator_->Verify(); 12339 if (allocator_ != NULL) allocator_->Verify();
12346 #endif 12340 #endif
12347 } 12341 }
12348 12342
12349 } } // namespace v8::internal 12343 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698