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

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

Issue 1722003: Added ability to remove prototype from function. In this case, [[Construct]] ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Fixes according to Erik's comments Created 10 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype)); 2106 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype));
2107 } 2107 }
2108 } 2108 }
2109 2109
2110 2110
2111 bool Map::has_non_instance_prototype() { 2111 bool Map::has_non_instance_prototype() {
2112 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0; 2112 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
2113 } 2113 }
2114 2114
2115 2115
2116 void Map::set_function_with_prototype(bool value) {
2117 if (value) {
2118 set_bit_field2(bit_field2() | (1 << kFunctionWithPrototype));
2119 } else {
2120 set_bit_field2(bit_field2() & ~(1 << kFunctionWithPrototype));
2121 }
2122 }
2123
2124
2125 bool Map::function_with_prototype() {
2126 return ((1 << kFunctionWithPrototype) & bit_field2()) != 0;
2127 }
2128
2129
2116 void Map::set_is_access_check_needed(bool access_check_needed) { 2130 void Map::set_is_access_check_needed(bool access_check_needed) {
2117 if (access_check_needed) { 2131 if (access_check_needed) {
2118 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); 2132 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded));
2119 } else { 2133 } else {
2120 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded)); 2134 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded));
2121 } 2135 }
2122 } 2136 }
2123 2137
2124 2138
2125 bool Map::is_access_check_needed() { 2139 bool Map::is_access_check_needed() {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 2575
2562 2576
2563 Object* JSFunction::prototype() { 2577 Object* JSFunction::prototype() {
2564 ASSERT(has_prototype()); 2578 ASSERT(has_prototype());
2565 // If the function's prototype property has been set to a non-JSObject 2579 // If the function's prototype property has been set to a non-JSObject
2566 // value, that value is stored in the constructor field of the map. 2580 // value, that value is stored in the constructor field of the map.
2567 if (map()->has_non_instance_prototype()) return map()->constructor(); 2581 if (map()->has_non_instance_prototype()) return map()->constructor();
2568 return instance_prototype(); 2582 return instance_prototype();
2569 } 2583 }
2570 2584
2585 bool JSFunction::should_have_prototype() {
2586 return map()->function_with_prototype();
2587 }
2588
2571 2589
2572 bool JSFunction::is_compiled() { 2590 bool JSFunction::is_compiled() {
2573 return shared()->is_compiled(); 2591 return shared()->is_compiled();
2574 } 2592 }
2575 2593
2576 2594
2577 int JSFunction::NumberOfLiterals() { 2595 int JSFunction::NumberOfLiterals() {
2578 return literals()->length(); 2596 return literals()->length();
2579 } 2597 }
2580 2598
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 #undef WRITE_INT_FIELD 3122 #undef WRITE_INT_FIELD
3105 #undef READ_SHORT_FIELD 3123 #undef READ_SHORT_FIELD
3106 #undef WRITE_SHORT_FIELD 3124 #undef WRITE_SHORT_FIELD
3107 #undef READ_BYTE_FIELD 3125 #undef READ_BYTE_FIELD
3108 #undef WRITE_BYTE_FIELD 3126 #undef WRITE_BYTE_FIELD
3109 3127
3110 3128
3111 } } // namespace v8::internal 3129 } } // namespace v8::internal
3112 3130
3113 #endif // V8_OBJECTS_INL_H_ 3131 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698