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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 1987183002: [stubs] Convert Internal/ArraySingleArgumentsConstructor to a TurboFan stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 4 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
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/schedule.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 // 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/field-index.h" 10 #include "src/field-index.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Isolate* isolate() { return info_->isolate(); } 74 Isolate* isolate() { return info_->isolate(); }
75 75
76 HLoadNamedField* BuildLoadNamedField(HValue* object, FieldIndex index); 76 HLoadNamedField* BuildLoadNamedField(HValue* object, FieldIndex index);
77 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index, 77 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index,
78 Representation representation, 78 Representation representation,
79 bool transition_to_field); 79 bool transition_to_field);
80 80
81 HValue* BuildPushElement(HValue* object, HValue* argc, 81 HValue* BuildPushElement(HValue* object, HValue* argc,
82 HValue* argument_elements, ElementsKind kind); 82 HValue* argument_elements, ElementsKind kind);
83 83
84 enum ArgumentClass {
85 NONE,
86 SINGLE,
87 MULTIPLE
88 };
89
90 HValue* UnmappedCase(HValue* elements, HValue* key, HValue* value); 84 HValue* UnmappedCase(HValue* elements, HValue* key, HValue* value);
91 HValue* EmitKeyedSloppyArguments(HValue* receiver, HValue* key, 85 HValue* EmitKeyedSloppyArguments(HValue* receiver, HValue* key,
92 HValue* value); 86 HValue* value);
93 87
94 HValue* BuildArrayConstructor(ElementsKind kind, 88 HValue* BuildArrayConstructor(ElementsKind kind,
95 AllocationSiteOverrideMode override_mode, 89 AllocationSiteOverrideMode override_mode);
96 ArgumentClass argument_class); 90 HValue* BuildInternalArrayConstructor(ElementsKind kind);
97 HValue* BuildInternalArrayConstructor(ElementsKind kind,
98 ArgumentClass argument_class);
99 91
100 HValue* BuildToString(HValue* input, bool convert); 92 HValue* BuildToString(HValue* input, bool convert);
101 HValue* BuildToPrimitive(HValue* input, HValue* input_map); 93 HValue* BuildToPrimitive(HValue* input, HValue* input_map);
102 94
103 private: 95 private:
104 HValue* BuildArraySingleArgumentConstructor(JSArrayBuilder* builder); 96 HValue* BuildArraySingleArgumentConstructor(JSArrayBuilder* builder);
105 HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder, 97 HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder,
106 ElementsKind kind); 98 ElementsKind kind);
107 99
108 base::SmartArrayPointer<HParameter*> parameters_; 100 base::SmartArrayPointer<HParameter*> parameters_;
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 1277
1286 return GetParameter(0); 1278 return GetParameter(0);
1287 } 1279 }
1288 1280
1289 1281
1290 Handle<Code> TransitionElementsKindStub::GenerateCode() { 1282 Handle<Code> TransitionElementsKindStub::GenerateCode() {
1291 return DoGenerateCode(this); 1283 return DoGenerateCode(this);
1292 } 1284 }
1293 1285
1294 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( 1286 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
1295 ElementsKind kind, 1287 ElementsKind kind, AllocationSiteOverrideMode override_mode) {
1296 AllocationSiteOverrideMode override_mode,
1297 ArgumentClass argument_class) {
1298 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); 1288 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor);
1299 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite); 1289 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite);
1300 JSArrayBuilder array_builder(this, kind, alloc_site, constructor, 1290 JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
1301 override_mode); 1291 override_mode);
1302 HValue* result = NULL; 1292 return BuildArrayNArgumentsConstructor(&array_builder, kind);
1303 switch (argument_class) { 1293 }
1304 case NONE:
1305 // This stub is very performance sensitive, the generated code must be
1306 // tuned so that it doesn't build and eager frame.
1307 info()->MarkMustNotHaveEagerFrame();
1308 result = array_builder.AllocateEmptyArray();
1309 break;
1310 case SINGLE:
1311 result = BuildArraySingleArgumentConstructor(&array_builder);
1312 break;
1313 case MULTIPLE:
1314 result = BuildArrayNArgumentsConstructor(&array_builder, kind);
1315 break;
1316 }
1317 1294
1318 return result; 1295 HValue* CodeStubGraphBuilderBase::BuildInternalArrayConstructor(
1296 ElementsKind kind) {
1297 HValue* constructor = GetParameter(
1298 InternalArrayConstructorStubBase::kConstructor);
1299 JSArrayBuilder array_builder(this, kind, constructor);
1300 return BuildArrayNArgumentsConstructor(&array_builder, kind);
1319 } 1301 }
1320 1302
1321 1303
1322 HValue* CodeStubGraphBuilderBase::BuildInternalArrayConstructor(
1323 ElementsKind kind, ArgumentClass argument_class) {
1324 HValue* constructor = GetParameter(
1325 InternalArrayConstructorStubBase::kConstructor);
1326 JSArrayBuilder array_builder(this, kind, constructor);
1327
1328 HValue* result = NULL;
1329 switch (argument_class) {
1330 case NONE:
1331 // This stub is very performance sensitive, the generated code must be
1332 // tuned so that it doesn't build and eager frame.
1333 info()->MarkMustNotHaveEagerFrame();
1334 result = array_builder.AllocateEmptyArray();
1335 break;
1336 case SINGLE:
1337 result = BuildArraySingleArgumentConstructor(&array_builder);
1338 break;
1339 case MULTIPLE:
1340 result = BuildArrayNArgumentsConstructor(&array_builder, kind);
1341 break;
1342 }
1343 return result;
1344 }
1345
1346
1347 HValue* CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor( 1304 HValue* CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor(
1348 JSArrayBuilder* array_builder) { 1305 JSArrayBuilder* array_builder) {
1349 // Smi check and range check on the input arg. 1306 // Smi check and range check on the input arg.
1350 HValue* constant_one = graph()->GetConstant1(); 1307 HValue* constant_one = graph()->GetConstant1();
1351 HValue* constant_zero = graph()->GetConstant0(); 1308 HValue* constant_zero = graph()->GetConstant0();
1352 1309
1353 HInstruction* elements = Add<HArgumentsElements>(false); 1310 HInstruction* elements = Add<HArgumentsElements>(false);
1354 HInstruction* argument = Add<HAccessArgumentsAt>( 1311 HInstruction* argument = Add<HAccessArgumentsAt>(
1355 elements, constant_one, constant_zero); 1312 elements, constant_one, constant_zero);
1356 1313
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 HInstruction* argument = Add<HAccessArgumentsAt>( 1353 HInstruction* argument = Add<HAccessArgumentsAt>(
1397 argument_elements, checked_length, key); 1354 argument_elements, checked_length, key);
1398 1355
1399 Add<HStoreKeyed>(elements, key, argument, nullptr, kind); 1356 Add<HStoreKeyed>(elements, key, argument, nullptr, kind);
1400 builder.EndBody(); 1357 builder.EndBody();
1401 return new_object; 1358 return new_object;
1402 } 1359 }
1403 1360
1404 1361
1405 template <> 1362 template <>
1406 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
1407 ElementsKind kind = casted_stub()->elements_kind();
1408 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
1409 return BuildArrayConstructor(kind, override_mode, NONE);
1410 }
1411
1412 template <>
1413 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>::
1414 BuildCodeStub() {
1415 ElementsKind kind = casted_stub()->elements_kind();
1416 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
1417 return BuildArrayConstructor(kind, override_mode, SINGLE);
1418 }
1419
1420
1421 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode() {
1422 return DoGenerateCode(this);
1423 }
1424
1425
1426 template <>
1427 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { 1363 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() {
1428 ElementsKind kind = casted_stub()->elements_kind(); 1364 ElementsKind kind = casted_stub()->elements_kind();
1429 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 1365 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
1430 return BuildArrayConstructor(kind, override_mode, MULTIPLE); 1366 return BuildArrayConstructor(kind, override_mode);
1431 } 1367 }
1432 1368
1433 1369
1434 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { 1370 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() {
1435 return DoGenerateCode(this); 1371 return DoGenerateCode(this);
1436 } 1372 }
1437 1373
1438 1374
1439 template <> 1375 template <>
1440 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>::
1441 BuildCodeStub() {
1442 ElementsKind kind = casted_stub()->elements_kind();
1443 return BuildInternalArrayConstructor(kind, NONE);
1444 }
1445
1446
1447 template <>
1448 HValue* CodeStubGraphBuilder<InternalArraySingleArgumentConstructorStub>::
1449 BuildCodeStub() {
1450 ElementsKind kind = casted_stub()->elements_kind();
1451 return BuildInternalArrayConstructor(kind, SINGLE);
1452 }
1453
1454
1455 Handle<Code> InternalArraySingleArgumentConstructorStub::GenerateCode() {
1456 return DoGenerateCode(this);
1457 }
1458
1459
1460 template <>
1461 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>:: 1376 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>::
1462 BuildCodeStub() { 1377 BuildCodeStub() {
1463 ElementsKind kind = casted_stub()->elements_kind(); 1378 ElementsKind kind = casted_stub()->elements_kind();
1464 return BuildInternalArrayConstructor(kind, MULTIPLE); 1379 return BuildInternalArrayConstructor(kind);
1465 } 1380 }
1466 1381
1467 1382
1468 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode() { 1383 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode() {
1469 return DoGenerateCode(this); 1384 return DoGenerateCode(this);
1470 } 1385 }
1471 1386
1472 1387
1473 template <> 1388 template <>
1474 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { 1389 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 return Pop(); 2189 return Pop();
2275 } 2190 }
2276 2191
2277 2192
2278 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2193 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2279 return DoGenerateCode(this); 2194 return DoGenerateCode(this);
2280 } 2195 }
2281 2196
2282 } // namespace internal 2197 } // namespace internal
2283 } // namespace v8 2198 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/schedule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698