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

Side by Side Diff: src/objects.h

Issue 8199004: Reimplement Function.prototype.bind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « src/macros.py ('k') | src/objects-inl.h » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4939 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 static const int kCompilerHintsSmiTagSize = 0; 4950 static const int kCompilerHintsSmiTagSize = 0;
4951 static const int kCompilerHintsSize = kIntSize; 4951 static const int kCompilerHintsSize = kIntSize;
4952 #endif 4952 #endif
4953 4953
4954 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= 4954 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <=
4955 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); 4955 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte);
4956 4956
4957 public: 4957 public:
4958 // Constants for optimizing codegen for strict mode function and 4958 // Constants for optimizing codegen for strict mode function and
4959 // native tests. 4959 // native tests.
4960 // Allows to use byte-widgh instructions. 4960 // Allows to use byte-witgh instructions.
PhistucK 2011/10/10 06:44:44 Almost there, s/witgh/width. ;)
Lasse Reichstein 2011/10/13 13:10:38 Good catch :)
4961 static const int kStrictModeBitWithinByte = 4961 static const int kStrictModeBitWithinByte =
4962 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; 4962 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
4963 4963
4964 static const int kNativeBitWithinByte = 4964 static const int kNativeBitWithinByte =
4965 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; 4965 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte;
4966 4966
4967 #if __BYTE_ORDER == __LITTLE_ENDIAN 4967 #if __BYTE_ORDER == __LITTLE_ENDIAN
4968 static const int kStrictModeByteOffset = kCompilerHintsOffset + 4968 static const int kStrictModeByteOffset = kCompilerHintsOffset +
4969 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; 4969 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte;
4970 static const int kNativeByteOffset = kCompilerHintsOffset + 4970 static const int kNativeByteOffset = kCompilerHintsOffset +
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5028 // recompiled the next time it is executed. 5028 // recompiled the next time it is executed.
5029 void MarkForLazyRecompilation(); 5029 void MarkForLazyRecompilation();
5030 5030
5031 // Tells whether or not the function is already marked for lazy 5031 // Tells whether or not the function is already marked for lazy
5032 // recompilation. 5032 // recompilation.
5033 inline bool IsMarkedForLazyRecompilation(); 5033 inline bool IsMarkedForLazyRecompilation();
5034 5034
5035 // Check whether or not this function is inlineable. 5035 // Check whether or not this function is inlineable.
5036 bool IsInlineable(); 5036 bool IsInlineable();
5037 5037
5038 // [literals]: Fixed array holding the materialized literals. 5038 // [literals_or_bindings]: Fixed array holding either
5039 // the materialized literals or the bindings of a bound function.
5039 // 5040 //
5040 // If the function contains object, regexp or array literals, the 5041 // If the function contains object, regexp or array literals, the
5041 // literals array prefix contains the object, regexp, and array 5042 // literals array prefix contains the object, regexp, and array
5042 // function to be used when creating these literals. This is 5043 // function to be used when creating these literals. This is
5043 // necessary so that we do not dynamically lookup the object, regexp 5044 // necessary so that we do not dynamically lookup the object, regexp
5044 // or array functions. Performing a dynamic lookup, we might end up 5045 // or array functions. Performing a dynamic lookup, we might end up
5045 // using the functions from a new context that we should not have 5046 // using the functions from a new context that we should not have
5046 // access to. 5047 // access to.
5047 DECL_ACCESSORS(literals, FixedArray) 5048 //
5049 // On bound functions, the array is a (copy-on-write) fixed-array containing
5050 // the function that was bound, bound this-value and any bound
5051 // arguments. Bound functions never contain literals.
5052 DECL_ACCESSORS(literals_or_bindings, FixedArray)
5053
5054 inline FixedArray* literals();
5055 inline void set_literals(FixedArray* literals);
5056
5057 inline FixedArray* function_bindings();
5058 inline void set_function_bindings(FixedArray* bindings);
5048 5059
5049 // The initial map for an object created by this constructor. 5060 // The initial map for an object created by this constructor.
5050 inline Map* initial_map(); 5061 inline Map* initial_map();
5051 inline void set_initial_map(Map* value); 5062 inline void set_initial_map(Map* value);
5052 inline bool has_initial_map(); 5063 inline bool has_initial_map();
5053 5064
5054 // Get and set the prototype property on a JSFunction. If the 5065 // Get and set the prototype property on a JSFunction. If the
5055 // function has an initial map the prototype is set on the initial 5066 // function has an initial map the prototype is set on the initial
5056 // map. Otherwise, the prototype is put in the initial map field 5067 // map. Otherwise, the prototype is put in the initial map field
5057 // until an initial map is needed. 5068 // until an initial map is needed.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; 5136 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize;
5126 static const int kLiteralsOffset = kContextOffset + kPointerSize; 5137 static const int kLiteralsOffset = kContextOffset + kPointerSize;
5127 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; 5138 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize;
5128 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; 5139 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset;
5129 static const int kSize = kNextFunctionLinkOffset + kPointerSize; 5140 static const int kSize = kNextFunctionLinkOffset + kPointerSize;
5130 5141
5131 // Layout of the literals array. 5142 // Layout of the literals array.
5132 static const int kLiteralsPrefixSize = 1; 5143 static const int kLiteralsPrefixSize = 1;
5133 static const int kLiteralGlobalContextIndex = 0; 5144 static const int kLiteralGlobalContextIndex = 0;
5134 5145
5146 // Layout of the bound-function binding array.
5147 static const int kBoundFunctionIndex = 0;
5148 static const int kBoundThisIndex = 1;
5149 static const int kBoundArgumentsStartIndex = 2;
5150
5135 private: 5151 private:
5136 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); 5152 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction);
5137 }; 5153 };
5138 5154
5139 5155
5140 // JSGlobalProxy's prototype must be a JSGlobalObject or null, 5156 // JSGlobalProxy's prototype must be a JSGlobalObject or null,
5141 // and the prototype is hidden. JSGlobalProxy always delegates 5157 // and the prototype is hidden. JSGlobalProxy always delegates
5142 // property accesses to its prototype if the prototype is not null. 5158 // property accesses to its prototype if the prototype is not null.
5143 // 5159 //
5144 // A JSGlobalProxy can be reinitialized which will preserve its identity. 5160 // A JSGlobalProxy can be reinitialized which will preserve its identity.
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after
7515 } else { 7531 } else {
7516 value &= ~(1 << bit_position); 7532 value &= ~(1 << bit_position);
7517 } 7533 }
7518 return value; 7534 return value;
7519 } 7535 }
7520 }; 7536 };
7521 7537
7522 } } // namespace v8::internal 7538 } } // namespace v8::internal
7523 7539
7524 #endif // V8_OBJECTS_H_ 7540 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/objects-inl.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698