OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 10195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10206 isolate->context()->native_context()->initial_object_prototype(), | 10206 isolate->context()->native_context()->initial_object_prototype(), |
10207 isolate); | 10207 isolate); |
10208 } else { | 10208 } else { |
10209 function->map()->set_non_instance_prototype(false); | 10209 function->map()->set_non_instance_prototype(false); |
10210 } | 10210 } |
10211 | 10211 |
10212 return SetInstancePrototype(function, construct_prototype); | 10212 return SetInstancePrototype(function, construct_prototype); |
10213 } | 10213 } |
10214 | 10214 |
10215 | 10215 |
10216 void JSFunction::RemovePrototype() { | 10216 bool JSFunction::RemovePrototype() { |
10217 Context* native_context = context()->native_context(); | 10217 Context* native_context = context()->native_context(); |
10218 Map* no_prototype_map = shared()->strict_mode() == SLOPPY | 10218 Map* no_prototype_map = shared()->strict_mode() == SLOPPY |
10219 ? native_context->sloppy_function_without_prototype_map() | 10219 ? native_context->sloppy_function_without_prototype_map() |
10220 : native_context->strict_function_without_prototype_map(); | 10220 : native_context->strict_function_without_prototype_map(); |
10221 | 10221 |
10222 if (map() == no_prototype_map) return; | 10222 if (map() == no_prototype_map) return true; |
10223 | 10223 |
10224 ASSERT(map() == (shared()->strict_mode() == SLOPPY | 10224 #ifdef DEBUG |
| 10225 if (map() != (shared()->strict_mode() == SLOPPY |
10225 ? native_context->sloppy_function_map() | 10226 ? native_context->sloppy_function_map() |
10226 : native_context->strict_function_map())); | 10227 : native_context->strict_function_map())) { |
| 10228 return false; |
| 10229 } |
| 10230 #endif |
10227 | 10231 |
10228 set_map(no_prototype_map); | 10232 set_map(no_prototype_map); |
10229 set_prototype_or_initial_map(no_prototype_map->GetHeap()->the_hole_value()); | 10233 set_prototype_or_initial_map(no_prototype_map->GetHeap()->the_hole_value()); |
| 10234 return true; |
10230 } | 10235 } |
10231 | 10236 |
10232 | 10237 |
10233 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { | 10238 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
10234 if (function->has_initial_map()) return; | 10239 if (function->has_initial_map()) return; |
10235 Isolate* isolate = function->GetIsolate(); | 10240 Isolate* isolate = function->GetIsolate(); |
10236 | 10241 |
10237 // First create a new map with the size and number of in-object properties | 10242 // First create a new map with the size and number of in-object properties |
10238 // suggested by the function. | 10243 // suggested by the function. |
10239 InstanceType instance_type; | 10244 InstanceType instance_type; |
(...skipping 6965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17205 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17210 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17206 static const char* error_messages_[] = { | 17211 static const char* error_messages_[] = { |
17207 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17212 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17208 }; | 17213 }; |
17209 #undef ERROR_MESSAGES_TEXTS | 17214 #undef ERROR_MESSAGES_TEXTS |
17210 return error_messages_[reason]; | 17215 return error_messages_[reason]; |
17211 } | 17216 } |
17212 | 17217 |
17213 | 17218 |
17214 } } // namespace v8::internal | 17219 } } // namespace v8::internal |
OLD | NEW |