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

Side by Side Diff: src/objects-inl.h

Issue 8199004: Reimplement Function.prototype.bind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments 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/objects.h ('k') | src/profile-generator.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 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 3289 matching lines...) Expand 10 before | Expand all | Expand 10 after
3300 return reinterpret_cast<FixedArray*>( 3300 return reinterpret_cast<FixedArray*>(
3301 READ_FIELD(this, kPrototypeTransitionsOffset)); 3301 READ_FIELD(this, kPrototypeTransitionsOffset));
3302 } 3302 }
3303 3303
3304 3304
3305 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) 3305 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
3306 ACCESSORS(Map, prototype_transitions, FixedArray, kPrototypeTransitionsOffset) 3306 ACCESSORS(Map, prototype_transitions, FixedArray, kPrototypeTransitionsOffset)
3307 ACCESSORS(Map, constructor, Object, kConstructorOffset) 3307 ACCESSORS(Map, constructor, Object, kConstructorOffset)
3308 3308
3309 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 3309 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
3310 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) 3310 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
3311 ACCESSORS(JSFunction, 3311 ACCESSORS(JSFunction,
3312 next_function_link, 3312 next_function_link,
3313 Object, 3313 Object,
3314 kNextFunctionLinkOffset) 3314 kNextFunctionLinkOffset)
3315 3315
3316 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 3316 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
3317 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) 3317 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
3318 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) 3318 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
3319 3319
3320 ACCESSORS(JSGlobalProxy, context, Object, kContextOffset) 3320 ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 bool JSFunction::should_have_prototype() { 3819 bool JSFunction::should_have_prototype() {
3820 return map()->function_with_prototype(); 3820 return map()->function_with_prototype();
3821 } 3821 }
3822 3822
3823 3823
3824 bool JSFunction::is_compiled() { 3824 bool JSFunction::is_compiled() {
3825 return code() != GetIsolate()->builtins()->builtin(Builtins::kLazyCompile); 3825 return code() != GetIsolate()->builtins()->builtin(Builtins::kLazyCompile);
3826 } 3826 }
3827 3827
3828 3828
3829 FixedArray* JSFunction::literals() {
3830 ASSERT(!shared()->bound());
3831 return literals_or_bindings();
3832 }
3833
3834
3835 void JSFunction::set_literals(FixedArray* literals) {
3836 ASSERT(!shared()->bound());
3837 set_literals_or_bindings(literals);
3838 }
3839
3840
3841 FixedArray* JSFunction::function_bindings() {
3842 ASSERT(shared()->bound());
3843 return literals_or_bindings();
3844 }
3845
3846
3847 void JSFunction::set_function_bindings(FixedArray* bindings) {
3848 ASSERT(shared()->bound());
3849 // Bound function literal may be initialized to the empty fixed array
3850 // before the bindings are set.
3851 ASSERT(bindings == GetHeap()->empty_fixed_array() ||
3852 bindings->map() == GetHeap()->fixed_cow_array_map());
3853 set_literals_or_bindings(bindings);
3854 }
3855
3856
3829 int JSFunction::NumberOfLiterals() { 3857 int JSFunction::NumberOfLiterals() {
3858 ASSERT(!shared()->bound());
3830 return literals()->length(); 3859 return literals()->length();
3831 } 3860 }
3832 3861
3833 3862
3834 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { 3863 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) {
3835 ASSERT(id < kJSBuiltinsCount); // id is unsigned. 3864 ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3836 return READ_FIELD(this, OffsetOfFunctionWithId(id)); 3865 return READ_FIELD(this, OffsetOfFunctionWithId(id));
3837 } 3866 }
3838 3867
3839 3868
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
4637 #undef WRITE_INT_FIELD 4666 #undef WRITE_INT_FIELD
4638 #undef READ_SHORT_FIELD 4667 #undef READ_SHORT_FIELD
4639 #undef WRITE_SHORT_FIELD 4668 #undef WRITE_SHORT_FIELD
4640 #undef READ_BYTE_FIELD 4669 #undef READ_BYTE_FIELD
4641 #undef WRITE_BYTE_FIELD 4670 #undef WRITE_BYTE_FIELD
4642 4671
4643 4672
4644 } } // namespace v8::internal 4673 } } // namespace v8::internal
4645 4674
4646 #endif // V8_OBJECTS_INL_H_ 4675 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698