OLD | NEW |
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 STATIC_ASSERT(KindBits::kSize == 4); | 947 STATIC_ASSERT(KindBits::kSize == 4); |
948 class InobjectBits: public BitField<bool, 4, 1> {}; | 948 class InobjectBits: public BitField<bool, 4, 1> {}; |
949 class IndexBits: public BitField<int, 5, 11> {}; | 949 class IndexBits: public BitField<int, 5, 11> {}; |
950 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; | 950 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; |
951 virtual CodeStub::Major MajorKey() { return LoadField; } | 951 virtual CodeStub::Major MajorKey() { return LoadField; } |
952 }; | 952 }; |
953 | 953 |
954 | 954 |
955 class StoreGlobalStub : public HandlerStub { | 955 class StoreGlobalStub : public HandlerStub { |
956 public: | 956 public: |
957 explicit StoreGlobalStub(bool is_constant, bool check_global) { | 957 explicit StoreGlobalStub(bool is_constant) { |
958 bit_field_ = IsConstantBits::encode(is_constant) | | 958 bit_field_ = IsConstantBits::encode(is_constant); |
959 CheckGlobalBits::encode(check_global); | |
960 } | |
961 | |
962 static Handle<HeapObject> global_placeholder(Isolate* isolate) { | |
963 return isolate->factory()->uninitialized_value(); | |
964 } | 959 } |
965 | 960 |
966 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, | 961 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, |
967 GlobalObject* global, | 962 Map* receiver_map, |
968 PropertyCell* cell) { | 963 PropertyCell* cell) { |
969 Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate); | 964 Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate); |
970 if (check_global()) { | 965 // Replace the placeholder cell and global object map with the actual global |
971 // Replace the placeholder cell and global object map with the actual | 966 // cell and receiver map. |
972 // global cell and receiver map. | |
973 code->ReplaceNthObject(1, global_placeholder(isolate)->map(), global); | |
974 code->ReplaceNthObject(1, isolate->heap()->meta_map(), global->map()); | |
975 } | |
976 Map* cell_map = isolate->heap()->global_property_cell_map(); | 967 Map* cell_map = isolate->heap()->global_property_cell_map(); |
977 code->ReplaceNthObject(1, cell_map, cell); | 968 code->ReplaceNthObject(1, cell_map, cell); |
| 969 code->ReplaceNthObject(1, isolate->heap()->meta_map(), receiver_map); |
978 return code; | 970 return code; |
979 } | 971 } |
980 | 972 |
981 virtual Code::Kind kind() const { return Code::STORE_IC; } | 973 virtual Code::Kind kind() const { return Code::STORE_IC; } |
982 | 974 |
983 virtual Handle<Code> GenerateCode(Isolate* isolate); | 975 virtual Handle<Code> GenerateCode(Isolate* isolate); |
984 | 976 |
985 virtual void InitializeInterfaceDescriptor( | 977 virtual void InitializeInterfaceDescriptor( |
986 Isolate* isolate, | 978 Isolate* isolate, |
987 CodeStubInterfaceDescriptor* descriptor); | 979 CodeStubInterfaceDescriptor* descriptor); |
988 | 980 |
989 bool is_constant() const { | 981 bool is_constant() { |
990 return IsConstantBits::decode(bit_field_); | 982 return IsConstantBits::decode(bit_field_); |
991 } | 983 } |
992 bool check_global() const { | |
993 return CheckGlobalBits::decode(bit_field_); | |
994 } | |
995 void set_is_constant(bool value) { | 984 void set_is_constant(bool value) { |
996 bit_field_ = IsConstantBits::update(bit_field_, value); | 985 bit_field_ = IsConstantBits::update(bit_field_, value); |
997 } | 986 } |
998 | 987 |
999 Representation representation() { | 988 Representation representation() { |
1000 return Representation::FromKind(RepresentationBits::decode(bit_field_)); | 989 return Representation::FromKind(RepresentationBits::decode(bit_field_)); |
1001 } | 990 } |
1002 void set_representation(Representation r) { | 991 void set_representation(Representation r) { |
1003 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); | 992 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); |
1004 } | 993 } |
1005 | 994 |
1006 private: | 995 private: |
1007 Major MajorKey() { return StoreGlobal; } | 996 Major MajorKey() { return StoreGlobal; } |
1008 | 997 |
1009 class IsConstantBits: public BitField<bool, 0, 1> {}; | 998 class IsConstantBits: public BitField<bool, 0, 1> {}; |
1010 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 999 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
1011 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | |
1012 | 1000 |
1013 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 1001 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
1014 }; | 1002 }; |
1015 | 1003 |
1016 | 1004 |
1017 class CallApiFunctionStub : public PlatformCodeStub { | 1005 class CallApiFunctionStub : public PlatformCodeStub { |
1018 public: | 1006 public: |
1019 CallApiFunctionStub(bool is_store, | 1007 CallApiFunctionStub(bool is_store, |
1020 bool call_data_undefined, | 1008 bool call_data_undefined, |
1021 int argc) { | 1009 int argc) { |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 | 2469 |
2482 | 2470 |
2483 class CallDescriptors { | 2471 class CallDescriptors { |
2484 public: | 2472 public: |
2485 static void InitializeForIsolate(Isolate* isolate); | 2473 static void InitializeForIsolate(Isolate* isolate); |
2486 }; | 2474 }; |
2487 | 2475 |
2488 } } // namespace v8::internal | 2476 } } // namespace v8::internal |
2489 | 2477 |
2490 #endif // V8_CODE_STUBS_H_ | 2478 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |