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

Side by Side Diff: src/bootstrapper.cc

Issue 177683002: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/ast.cc ('k') | src/builtins.h » ('j') | src/globals.h » ('J')
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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // assertions during startup. 512 // assertions during startup.
513 native_context()->set_initial_array_prototype(*prototype); 513 native_context()->set_initial_array_prototype(*prototype);
514 Accessors::FunctionSetPrototype(object_fun, prototype); 514 Accessors::FunctionSetPrototype(object_fun, prototype);
515 } 515 }
516 516
517 // Allocate the empty function as the prototype for function ECMAScript 517 // Allocate the empty function as the prototype for function ECMAScript
518 // 262 15.3.4. 518 // 262 15.3.4.
519 Handle<String> empty_string = 519 Handle<String> empty_string =
520 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); 520 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty"));
521 Handle<JSFunction> empty_function = 521 Handle<JSFunction> empty_function =
522 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); 522 factory->NewFunctionWithoutPrototype(empty_string, SLOPPY_MODE);
523 523
524 // --- E m p t y --- 524 // --- E m p t y ---
525 Handle<Code> code = 525 Handle<Code> code =
526 Handle<Code>(isolate->builtins()->builtin( 526 Handle<Code>(isolate->builtins()->builtin(
527 Builtins::kEmptyFunction)); 527 Builtins::kEmptyFunction));
528 empty_function->set_code(*code); 528 empty_function->set_code(*code);
529 empty_function->shared()->set_code(*code); 529 empty_function->shared()->set_code(*code);
530 Handle<String> source = 530 Handle<String> source =
531 factory->NewStringFromOneByte(STATIC_ASCII_VECTOR("() {}")); 531 factory->NewStringFromOneByte(STATIC_ASCII_VECTOR("() {}"));
532 Handle<Script> script = factory->NewScript(source); 532 Handle<Script> script = factory->NewScript(source);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 } 598 }
599 599
600 600
601 // ECMAScript 5th Edition, 13.2.3 601 // ECMAScript 5th Edition, 13.2.3
602 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { 602 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
603 if (throw_type_error_function.is_null()) { 603 if (throw_type_error_function.is_null()) {
604 Handle<String> name = factory()->InternalizeOneByteString( 604 Handle<String> name = factory()->InternalizeOneByteString(
605 STATIC_ASCII_VECTOR("ThrowTypeError")); 605 STATIC_ASCII_VECTOR("ThrowTypeError"));
606 throw_type_error_function = 606 throw_type_error_function =
607 factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE); 607 factory()->NewFunctionWithoutPrototype(name, SLOPPY_MODE);
608 Handle<Code> code(isolate()->builtins()->builtin( 608 Handle<Code> code(isolate()->builtins()->builtin(
609 Builtins::kStrictModePoisonPill)); 609 Builtins::kStrictModePoisonPill));
610 throw_type_error_function->set_map( 610 throw_type_error_function->set_map(
611 native_context()->function_map()); 611 native_context()->function_map());
612 throw_type_error_function->set_code(*code); 612 throw_type_error_function->set_code(*code);
613 throw_type_error_function->shared()->set_code(*code); 613 throw_type_error_function->shared()->set_code(*code);
614 throw_type_error_function->shared()->DontAdaptArguments(); 614 throw_type_error_function->shared()->DontAdaptArguments();
615 615
616 JSObject::PreventExtensions(throw_type_error_function); 616 JSObject::PreventExtensions(throw_type_error_function);
617 } 617 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1166
1167 // Check the state of the object. 1167 // Check the state of the object.
1168 ASSERT(result->HasFastProperties()); 1168 ASSERT(result->HasFastProperties());
1169 ASSERT(result->HasFastObjectElements()); 1169 ASSERT(result->HasFastObjectElements());
1170 #endif 1170 #endif
1171 } 1171 }
1172 1172
1173 { // --- aliased_arguments_boilerplate_ 1173 { // --- aliased_arguments_boilerplate_
1174 // Set up a well-formed parameter map to make assertions happy. 1174 // Set up a well-formed parameter map to make assertions happy.
1175 Handle<FixedArray> elements = factory->NewFixedArray(2); 1175 Handle<FixedArray> elements = factory->NewFixedArray(2);
1176 elements->set_map(heap->non_strict_arguments_elements_map()); 1176 elements->set_map(heap->sloppy_arguments_elements_map());
1177 Handle<FixedArray> array; 1177 Handle<FixedArray> array;
1178 array = factory->NewFixedArray(0); 1178 array = factory->NewFixedArray(0);
1179 elements->set(0, *array); 1179 elements->set(0, *array);
1180 array = factory->NewFixedArray(0); 1180 array = factory->NewFixedArray(0);
1181 elements->set(1, *array); 1181 elements->set(1, *array);
1182 1182
1183 Handle<Map> old_map(native_context()->arguments_boilerplate()->map()); 1183 Handle<Map> old_map(native_context()->arguments_boilerplate()->map());
1184 Handle<Map> new_map = factory->CopyMap(old_map); 1184 Handle<Map> new_map = factory->CopyMap(old_map);
1185 new_map->set_pre_allocated_property_fields(2); 1185 new_map->set_pre_allocated_property_fields(2);
1186 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); 1186 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
1187 // Set elements kind after allocating the object because 1187 // Set elements kind after allocating the object because
1188 // NewJSObjectFromMap assumes a fast elements map. 1188 // NewJSObjectFromMap assumes a fast elements map.
1189 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); 1189 new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
1190 result->set_elements(*elements); 1190 result->set_elements(*elements);
1191 ASSERT(result->HasNonStrictArgumentsElements()); 1191 ASSERT(result->HasSloppyArgumentsElements());
1192 native_context()->set_aliased_arguments_boilerplate(*result); 1192 native_context()->set_aliased_arguments_boilerplate(*result);
1193 } 1193 }
1194 1194
1195 { // --- strict mode arguments boilerplate 1195 { // --- strict mode arguments boilerplate
1196 const PropertyAttributes attributes = 1196 const PropertyAttributes attributes =
1197 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 1197 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1198 1198
1199 // Create the ThrowTypeError functions. 1199 // Create the ThrowTypeError functions.
1200 Handle<AccessorPair> callee = factory->NewAccessorPair(); 1200 Handle<AccessorPair> callee = factory->NewAccessorPair();
1201 Handle<AccessorPair> caller = factory->NewAccessorPair(); 1201 Handle<AccessorPair> caller = factory->NewAccessorPair();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 *caller, 1233 *caller,
1234 attributes); 1234 attributes);
1235 map->AppendDescriptor(&d, witness); 1235 map->AppendDescriptor(&d, witness);
1236 } 1236 }
1237 1237
1238 map->set_function_with_prototype(true); 1238 map->set_function_with_prototype(true);
1239 map->set_prototype(native_context()->object_function()->prototype()); 1239 map->set_prototype(native_context()->object_function()->prototype());
1240 map->set_pre_allocated_property_fields(1); 1240 map->set_pre_allocated_property_fields(1);
1241 map->set_inobject_properties(1); 1241 map->set_inobject_properties(1);
1242 1242
1243 // Copy constructor from the non-strict arguments boilerplate. 1243 // Copy constructor from the sloppy arguments boilerplate.
1244 map->set_constructor( 1244 map->set_constructor(
1245 native_context()->arguments_boilerplate()->map()->constructor()); 1245 native_context()->arguments_boilerplate()->map()->constructor());
1246 1246
1247 // Allocate the arguments boilerplate object. 1247 // Allocate the arguments boilerplate object.
1248 Handle<JSObject> result = factory->NewJSObjectFromMap(map); 1248 Handle<JSObject> result = factory->NewJSObjectFromMap(map);
1249 native_context()->set_strict_mode_arguments_boilerplate(*result); 1249 native_context()->set_strict_mode_arguments_boilerplate(*result);
1250 1250
1251 // Add length property only for strict mode boilerplate. 1251 // Add length property only for strict mode boilerplate.
1252 CHECK_NOT_EMPTY_HANDLE(isolate, 1252 CHECK_NOT_EMPTY_HANDLE(isolate,
1253 JSObject::SetLocalPropertyIgnoreAttributes( 1253 JSObject::SetLocalPropertyIgnoreAttributes(
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 return from + sizeof(NestingCounterType); 2746 return from + sizeof(NestingCounterType);
2747 } 2747 }
2748 2748
2749 2749
2750 // Called when the top-level V8 mutex is destroyed. 2750 // Called when the top-level V8 mutex is destroyed.
2751 void Bootstrapper::FreeThreadResources() { 2751 void Bootstrapper::FreeThreadResources() {
2752 ASSERT(!IsActive()); 2752 ASSERT(!IsActive());
2753 } 2753 }
2754 2754
2755 } } // namespace v8::internal 2755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/builtins.h » ('j') | src/globals.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698