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