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

Side by Side Diff: src/code-stubs.h

Issue 1238143002: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ia32 port. small x64 beautification. Created 5 years, 5 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 | « no previous file | src/code-stubs.cc » ('j') | src/compiler/js-generic-lowering.cc » ('J')
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 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 private: 1380 private:
1381 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; 1381 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
1382 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; 1382 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {};
1383 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; 1383 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
1384 class CheckGlobalBits : public BitField<bool, 12, 1> {}; 1384 class CheckGlobalBits : public BitField<bool, 12, 1> {};
1385 1385
1386 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); 1386 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
1387 }; 1387 };
1388 1388
1389 1389
1390 class LoadGlobalViaContextStub : public HydrogenCodeStub { 1390 class LoadGlobalViaContextStub final : public PlatformCodeStub {
1391 public: 1391 public:
1392 // Use the loop version for depths higher than this one. 1392 static const int kMaximumDepth = 15;
1393 static const int kDynamicDepth = 7;
1394 1393
1395 LoadGlobalViaContextStub(Isolate* isolate, int depth) 1394 LoadGlobalViaContextStub(Isolate* isolate, int depth)
1396 : HydrogenCodeStub(isolate) { 1395 : PlatformCodeStub(isolate) {
1397 if (depth > kDynamicDepth) depth = kDynamicDepth; 1396 minor_key_ = DepthBits::encode(depth);
1398 set_sub_minor_key(DepthBits::encode(depth));
1399 } 1397 }
1400 1398
1401 int depth() const { return DepthBits::decode(sub_minor_key()); } 1399 int depth() const { return DepthBits::decode(minor_key_); }
1402 1400
1403 private: 1401 private:
1404 class DepthBits : public BitField<unsigned int, 0, 3> {}; 1402 class DepthBits : public BitField<int, 0, 4> {};
1405 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); 1403 STATIC_ASSERT(DepthBits::kMax == kMaximumDepth);
1406 1404
1407 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext); 1405 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext);
1408 DEFINE_HYDROGEN_CODE_STUB(LoadGlobalViaContext, HydrogenCodeStub); 1406 DEFINE_PLATFORM_CODE_STUB(LoadGlobalViaContext, PlatformCodeStub);
1409 }; 1407 };
1410 1408
1411 1409
1412 class StoreGlobalViaContextStub : public HydrogenCodeStub { 1410 class StoreGlobalViaContextStub final : public PlatformCodeStub {
1413 public: 1411 public:
1414 // Use the loop version for depths higher than this one. 1412 static const int kMaximumDepth = 15;
1415 static const int kDynamicDepth = 7;
1416 1413
1417 StoreGlobalViaContextStub(Isolate* isolate, int depth, 1414 StoreGlobalViaContextStub(Isolate* isolate, int depth,
1418 LanguageMode language_mode) 1415 LanguageMode language_mode)
1419 : HydrogenCodeStub(isolate) { 1416 : PlatformCodeStub(isolate) {
1420 if (depth > kDynamicDepth) depth = kDynamicDepth; 1417 minor_key_ =
1421 set_sub_minor_key(DepthBits::encode(depth) | 1418 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode);
1422 LanguageModeBits::encode(language_mode));
1423 } 1419 }
1424 1420
1425 int depth() const { return DepthBits::decode(sub_minor_key()); } 1421 int depth() const { return DepthBits::decode(minor_key_); }
1426
1427 LanguageMode language_mode() const { 1422 LanguageMode language_mode() const {
1428 return LanguageModeBits::decode(sub_minor_key()); 1423 return LanguageModeBits::decode(minor_key_);
1429 } 1424 }
1430 1425
1431 private: 1426 private:
1432 class DepthBits : public BitField<unsigned int, 0, 4> {}; 1427 class DepthBits : public BitField<int, 0, 4> {};
1433 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); 1428 STATIC_ASSERT(DepthBits::kMax == kMaximumDepth);
1434
1435 class LanguageModeBits : public BitField<LanguageMode, 4, 2> {}; 1429 class LanguageModeBits : public BitField<LanguageMode, 4, 2> {};
1436 STATIC_ASSERT(LANGUAGE_END == 3); 1430 STATIC_ASSERT(LANGUAGE_END == 3);
1437 1431
1438 private:
1439 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext); 1432 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext);
1440 DEFINE_HYDROGEN_CODE_STUB(StoreGlobalViaContext, HydrogenCodeStub); 1433 DEFINE_PLATFORM_CODE_STUB(StoreGlobalViaContext, PlatformCodeStub);
1441 }; 1434 };
1442 1435
1443 1436
1444 class CallApiFunctionStub : public PlatformCodeStub { 1437 class CallApiFunctionStub : public PlatformCodeStub {
1445 public: 1438 public:
1446 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) 1439 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined)
1447 : PlatformCodeStub(isolate) { 1440 : PlatformCodeStub(isolate) {
1448 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); 1441 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined);
1449 } 1442 }
1450 1443
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
3083 #undef DEFINE_PLATFORM_CODE_STUB 3076 #undef DEFINE_PLATFORM_CODE_STUB
3084 #undef DEFINE_HANDLER_CODE_STUB 3077 #undef DEFINE_HANDLER_CODE_STUB
3085 #undef DEFINE_HYDROGEN_CODE_STUB 3078 #undef DEFINE_HYDROGEN_CODE_STUB
3086 #undef DEFINE_CODE_STUB 3079 #undef DEFINE_CODE_STUB
3087 #undef DEFINE_CODE_STUB_BASE 3080 #undef DEFINE_CODE_STUB_BASE
3088 3081
3089 extern Representation RepresentationFromType(Type* type); 3082 extern Representation RepresentationFromType(Type* type);
3090 } } // namespace v8::internal 3083 } } // namespace v8::internal
3091 3084
3092 #endif // V8_CODE_STUBS_H_ 3085 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/compiler/js-generic-lowering.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698