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

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: Fix ARM typo. 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
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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 private: 1389 private:
1390 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; 1390 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
1391 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; 1391 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {};
1392 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; 1392 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
1393 class CheckGlobalBits : public BitField<bool, 12, 1> {}; 1393 class CheckGlobalBits : public BitField<bool, 12, 1> {};
1394 1394
1395 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); 1395 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
1396 }; 1396 };
1397 1397
1398 1398
1399 class LoadGlobalViaContextStub : public HydrogenCodeStub { 1399 class LoadGlobalViaContextStub final : public PlatformCodeStub {
1400 public: 1400 public:
1401 // Use the loop version for depths higher than this one. 1401 static const int kMaximumDepth = 15;
1402 static const int kDynamicDepth = 7;
1403 1402
1404 LoadGlobalViaContextStub(Isolate* isolate, int depth) 1403 LoadGlobalViaContextStub(Isolate* isolate, int depth)
1405 : HydrogenCodeStub(isolate) { 1404 : PlatformCodeStub(isolate) {
1406 if (depth > kDynamicDepth) depth = kDynamicDepth; 1405 minor_key_ = DepthBits::encode(depth);
1407 set_sub_minor_key(DepthBits::encode(depth));
1408 } 1406 }
1409 1407
1410 int depth() const { return DepthBits::decode(sub_minor_key()); } 1408 int depth() const { return DepthBits::decode(minor_key_); }
1411 1409
1412 private: 1410 private:
1413 class DepthBits : public BitField<unsigned int, 0, 3> {}; 1411 class DepthBits : public BitField<int, 0, 4> {};
1414 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); 1412 STATIC_ASSERT(DepthBits::kMax == kMaximumDepth);
1415 1413
1416 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext); 1414 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext);
1417 DEFINE_HYDROGEN_CODE_STUB(LoadGlobalViaContext, HydrogenCodeStub); 1415 DEFINE_PLATFORM_CODE_STUB(LoadGlobalViaContext, PlatformCodeStub);
1418 }; 1416 };
1419 1417
1420 1418
1421 class StoreGlobalViaContextStub : public HydrogenCodeStub { 1419 class StoreGlobalViaContextStub final : public PlatformCodeStub {
1422 public: 1420 public:
1423 // Use the loop version for depths higher than this one. 1421 static const int kMaximumDepth = 15;
1424 static const int kDynamicDepth = 7;
1425 1422
1426 StoreGlobalViaContextStub(Isolate* isolate, int depth, 1423 StoreGlobalViaContextStub(Isolate* isolate, int depth,
1427 LanguageMode language_mode) 1424 LanguageMode language_mode)
1428 : HydrogenCodeStub(isolate) { 1425 : PlatformCodeStub(isolate) {
1429 if (depth > kDynamicDepth) depth = kDynamicDepth; 1426 minor_key_ =
1430 set_sub_minor_key(DepthBits::encode(depth) | 1427 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode);
1431 LanguageModeBits::encode(language_mode));
1432 } 1428 }
1433 1429
1434 int depth() const { return DepthBits::decode(sub_minor_key()); } 1430 int depth() const { return DepthBits::decode(minor_key_); }
1435
1436 LanguageMode language_mode() const { 1431 LanguageMode language_mode() const {
1437 return LanguageModeBits::decode(sub_minor_key()); 1432 return LanguageModeBits::decode(minor_key_);
1438 } 1433 }
1439 1434
1440 private: 1435 private:
1441 class DepthBits : public BitField<unsigned int, 0, 4> {}; 1436 class DepthBits : public BitField<int, 0, 4> {};
1442 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); 1437 STATIC_ASSERT(DepthBits::kMax == kMaximumDepth);
1443
1444 class LanguageModeBits : public BitField<LanguageMode, 4, 2> {}; 1438 class LanguageModeBits : public BitField<LanguageMode, 4, 2> {};
1445 STATIC_ASSERT(LANGUAGE_END == 3); 1439 STATIC_ASSERT(LANGUAGE_END == 3);
1446 1440
1447 private:
1448 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext); 1441 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext);
1449 DEFINE_HYDROGEN_CODE_STUB(StoreGlobalViaContext, HydrogenCodeStub); 1442 DEFINE_PLATFORM_CODE_STUB(StoreGlobalViaContext, PlatformCodeStub);
1450 }; 1443 };
1451 1444
1452 1445
1453 class CallApiFunctionStub : public PlatformCodeStub { 1446 class CallApiFunctionStub : public PlatformCodeStub {
1454 public: 1447 public:
1455 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) 1448 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined)
1456 : PlatformCodeStub(isolate) { 1449 : PlatformCodeStub(isolate) {
1457 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); 1450 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined);
1458 } 1451 }
1459 1452
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 #undef DEFINE_PLATFORM_CODE_STUB 3063 #undef DEFINE_PLATFORM_CODE_STUB
3071 #undef DEFINE_HANDLER_CODE_STUB 3064 #undef DEFINE_HANDLER_CODE_STUB
3072 #undef DEFINE_HYDROGEN_CODE_STUB 3065 #undef DEFINE_HYDROGEN_CODE_STUB
3073 #undef DEFINE_CODE_STUB 3066 #undef DEFINE_CODE_STUB
3074 #undef DEFINE_CODE_STUB_BASE 3067 #undef DEFINE_CODE_STUB_BASE
3075 3068
3076 extern Representation RepresentationFromType(Type* type); 3069 extern Representation RepresentationFromType(Type* type);
3077 } } // namespace v8::internal 3070 } } // namespace v8::internal
3078 3071
3079 #endif // V8_CODE_STUBS_H_ 3072 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698