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