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

Side by Side Diff: src/objects.h

Issue 238543005: Move property addition code from JSObject to Map (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed last comments Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 Handle<Name> name, 2886 Handle<Name> name,
2887 Handle<Object> value, 2887 Handle<Object> value,
2888 PropertyAttributes attributes, 2888 PropertyAttributes attributes,
2889 StrictMode strict_mode, 2889 StrictMode strict_mode,
2890 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, 2890 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
2891 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, 2891 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
2892 ValueType value_type = OPTIMAL_REPRESENTATION, 2892 ValueType value_type = OPTIMAL_REPRESENTATION,
2893 StoreMode mode = ALLOW_AS_CONSTANT, 2893 StoreMode mode = ALLOW_AS_CONSTANT,
2894 TransitionFlag flag = INSERT_TRANSITION); 2894 TransitionFlag flag = INSERT_TRANSITION);
2895 2895
2896 // Add a constant function property to a fast-case object.
2897 // This leaves a CONSTANT_TRANSITION in the old map, and
2898 // if it is called on a second object with this map, a
2899 // normal property is added instead, with a map transition.
2900 // This avoids the creation of many maps with the same constant
2901 // function, all orphaned.
2902 static void AddConstantProperty(Handle<JSObject> object,
2903 Handle<Name> name,
2904 Handle<Object> constant,
2905 PropertyAttributes attributes,
2906 TransitionFlag flag);
2907
2908 // Add a property to a fast-case object. 2896 // Add a property to a fast-case object.
2909 static void AddFastProperty(Handle<JSObject> object, 2897 static void AddFastProperty(Handle<JSObject> object,
2910 Handle<Name> name, 2898 Handle<Name> name,
2911 Handle<Object> value, 2899 Handle<Object> value,
2912 PropertyAttributes attributes, 2900 PropertyAttributes attributes,
2913 StoreFromKeyed store_mode, 2901 StoreFromKeyed store_mode,
2914 ValueType value_type, 2902 ValueType value_type,
2915 TransitionFlag flag); 2903 TransitionFlag flag);
2916 2904
2917 // Add a property to a slow-case object. 2905 // Add a property to a slow-case object.
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 Handle<Map> map, 6413 Handle<Map> map,
6426 Handle<DescriptorArray> descriptors, 6414 Handle<DescriptorArray> descriptors,
6427 TransitionFlag flag, 6415 TransitionFlag flag,
6428 Handle<Name> name, 6416 Handle<Name> name,
6429 SimpleTransitionFlag simple_flag = FULL_TRANSITION); 6417 SimpleTransitionFlag simple_flag = FULL_TRANSITION);
6430 static Handle<Map> CopyReplaceDescriptors( 6418 static Handle<Map> CopyReplaceDescriptors(
6431 Handle<Map> map, 6419 Handle<Map> map,
6432 Handle<DescriptorArray> descriptors, 6420 Handle<DescriptorArray> descriptors,
6433 TransitionFlag flag, 6421 TransitionFlag flag,
6434 SimpleTransitionFlag simple_flag = FULL_TRANSITION); 6422 SimpleTransitionFlag simple_flag = FULL_TRANSITION);
6435 static Handle<Map> CopyAddDescriptor(Handle<Map> map,
6436 Descriptor* descriptor,
6437 TransitionFlag flag);
6438 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, 6423 static Handle<Map> CopyInsertDescriptor(Handle<Map> map,
6439 Descriptor* descriptor, 6424 Descriptor* descriptor,
6440 TransitionFlag flag); 6425 TransitionFlag flag);
6441 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, 6426 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map,
6442 Handle<DescriptorArray> descriptors, 6427 Handle<DescriptorArray> descriptors,
6443 Descriptor* descriptor, 6428 Descriptor* descriptor,
6444 int index, 6429 int index,
6445 TransitionFlag flag); 6430 TransitionFlag flag);
6446 6431
6432 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField(
6433 Handle<Map> map,
6434 Handle<Name> name,
6435 Handle<HeapType> type,
6436 PropertyAttributes attributes,
6437 Representation representation,
6438 TransitionFlag flag);
6439
6440 MUST_USE_RESULT static MaybeHandle<Map> CopyWithConstant(
6441 Handle<Map> map,
6442 Handle<Name> name,
6443 Handle<Object> constant,
6444 PropertyAttributes attributes,
6445 TransitionFlag flag);
6446
6447 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); 6447 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind);
6448 6448
6449 static Handle<Map> CopyAsElementsKind(Handle<Map> map, 6449 static Handle<Map> CopyAsElementsKind(Handle<Map> map,
6450 ElementsKind kind, 6450 ElementsKind kind,
6451 TransitionFlag flag); 6451 TransitionFlag flag);
6452 6452
6453 static Handle<Map> CopyForObserved(Handle<Map> map); 6453 static Handle<Map> CopyForObserved(Handle<Map> map);
6454 6454
6455 static Handle<Map> CopyNormalized(Handle<Map> map, 6455 static Handle<Map> CopyNormalized(Handle<Map> map,
6456 PropertyNormalizationMode mode, 6456 PropertyNormalizationMode mode,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6687 private: 6687 private:
6688 bool EquivalentToForTransition(Map* other); 6688 bool EquivalentToForTransition(Map* other);
6689 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); 6689 static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
6690 static Handle<Map> ShareDescriptor(Handle<Map> map, 6690 static Handle<Map> ShareDescriptor(Handle<Map> map,
6691 Handle<DescriptorArray> descriptors, 6691 Handle<DescriptorArray> descriptors,
6692 Descriptor* descriptor); 6692 Descriptor* descriptor);
6693 static Handle<Map> CopyInstallDescriptors( 6693 static Handle<Map> CopyInstallDescriptors(
6694 Handle<Map> map, 6694 Handle<Map> map,
6695 int new_descriptor, 6695 int new_descriptor,
6696 Handle<DescriptorArray> descriptors); 6696 Handle<DescriptorArray> descriptors);
6697 static Handle<Map> CopyAddDescriptor(Handle<Map> map,
6698 Descriptor* descriptor,
6699 TransitionFlag flag);
6697 6700
6698 // Zaps the contents of backing data structures. Note that the 6701 // Zaps the contents of backing data structures. Note that the
6699 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects 6702 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
6700 // holding weak references when incremental marking is used, because it also 6703 // holding weak references when incremental marking is used, because it also
6701 // iterates over objects that are otherwise unreachable. 6704 // iterates over objects that are otherwise unreachable.
6702 // In general we only want to call these functions in release mode when 6705 // In general we only want to call these functions in release mode when
6703 // heap verification is turned on. 6706 // heap verification is turned on.
6704 void ZapPrototypeTransitions(); 6707 void ZapPrototypeTransitions();
6705 void ZapTransitions(); 6708 void ZapTransitions();
6706 6709
(...skipping 4348 matching lines...) Expand 10 before | Expand all | Expand 10 after
11055 } else { 11058 } else {
11056 value &= ~(1 << bit_position); 11059 value &= ~(1 << bit_position);
11057 } 11060 }
11058 return value; 11061 return value;
11059 } 11062 }
11060 }; 11063 };
11061 11064
11062 } } // namespace v8::internal 11065 } } // namespace v8::internal
11063 11066
11064 #endif // V8_OBJECTS_H_ 11067 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698