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