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

Side by Side Diff: src/factory.cc

Issue 10878047: Revert to code state of 3.13.1 plus r12350 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 3 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/factory.h ('k') | src/flag-definitions.h » ('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 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 Handle<String> Factory::NewExternalStringFromTwoByte( 278 Handle<String> Factory::NewExternalStringFromTwoByte(
279 const ExternalTwoByteString::Resource* resource) { 279 const ExternalTwoByteString::Resource* resource) {
280 CALL_HEAP_FUNCTION( 280 CALL_HEAP_FUNCTION(
281 isolate(), 281 isolate(),
282 isolate()->heap()->AllocateExternalStringFromTwoByte(resource), 282 isolate()->heap()->AllocateExternalStringFromTwoByte(resource),
283 String); 283 String);
284 } 284 }
285 285
286 286
287 Handle<Context> Factory::NewNativeContext() { 287 Handle<Context> Factory::NewGlobalContext() {
288 CALL_HEAP_FUNCTION( 288 CALL_HEAP_FUNCTION(
289 isolate(), 289 isolate(),
290 isolate()->heap()->AllocateNativeContext(), 290 isolate()->heap()->AllocateGlobalContext(),
291 Context); 291 Context);
292 } 292 }
293 293
294 294
295 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { 295 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) {
296 CALL_HEAP_FUNCTION( 296 CALL_HEAP_FUNCTION(
297 isolate(), 297 isolate(),
298 isolate()->heap()->AllocateModuleContext(*scope_info), 298 isolate()->heap()->AllocateModuleContext(*scope_info),
299 Context); 299 Context);
300 } 300 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 ? isolate()->function_map() 545 ? isolate()->function_map()
546 : isolate()->strict_mode_function_map(), 546 : isolate()->strict_mode_function_map(),
547 pretenure); 547 pretenure);
548 548
549 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { 549 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) {
550 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); 550 function_info->ResetForNewContext(isolate()->heap()->global_ic_age());
551 } 551 }
552 552
553 result->set_context(*context); 553 result->set_context(*context);
554 554
555 int index = function_info->SearchOptimizedCodeMap(context->native_context()); 555 int index = function_info->SearchOptimizedCodeMap(context->global_context());
556 if (!function_info->bound() && index < 0) { 556 if (!function_info->bound() && index < 0) {
557 int number_of_literals = function_info->num_literals(); 557 int number_of_literals = function_info->num_literals();
558 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); 558 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
559 if (number_of_literals > 0) { 559 if (number_of_literals > 0) {
560 // Store the native context in the literals array prefix. This 560 // Store the global context in the literals array prefix. This
561 // context will be used when creating object, regexp and array 561 // context will be used when creating object, regexp and array
562 // literals in this function. 562 // literals in this function.
563 literals->set(JSFunction::kLiteralNativeContextIndex, 563 literals->set(JSFunction::kLiteralGlobalContextIndex,
564 context->native_context()); 564 context->global_context());
565 } 565 }
566 result->set_literals(*literals); 566 result->set_literals(*literals);
567 } 567 }
568 568
569 if (index > 0) { 569 if (index > 0) {
570 // Caching of optimized code enabled and optimized code found. 570 // Caching of optimized code enabled and optimized code found.
571 function_info->InstallFromOptimizedCodeMap(*result, index); 571 function_info->InstallFromOptimizedCodeMap(*result, index);
572 return result; 572 return result;
573 } 573 }
574 574
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 isolate()->heap()->AllocateFunction(*isolate()->function_map(), 1103 isolate()->heap()->AllocateFunction(*isolate()->function_map(),
1104 *function_share, 1104 *function_share,
1105 *prototype), 1105 *prototype),
1106 JSFunction); 1106 JSFunction);
1107 } 1107 }
1108 1108
1109 1109
1110 Handle<JSFunction> Factory::NewFunction(Handle<String> name, 1110 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
1111 Handle<Object> prototype) { 1111 Handle<Object> prototype) {
1112 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); 1112 Handle<JSFunction> fun = NewFunctionHelper(name, prototype);
1113 fun->set_context(isolate()->context()->native_context()); 1113 fun->set_context(isolate()->context()->global_context());
1114 return fun; 1114 return fun;
1115 } 1115 }
1116 1116
1117 1117
1118 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( 1118 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
1119 Handle<String> name, 1119 Handle<String> name,
1120 LanguageMode language_mode) { 1120 LanguageMode language_mode) {
1121 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); 1121 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
1122 Handle<Map> map = (language_mode == CLASSIC_MODE) 1122 Handle<Map> map = (language_mode == CLASSIC_MODE)
1123 ? isolate()->function_without_prototype_map() 1123 ? isolate()->function_without_prototype_map()
1124 : isolate()->strict_mode_function_without_prototype_map(); 1124 : isolate()->strict_mode_function_without_prototype_map();
1125 CALL_HEAP_FUNCTION(isolate(), 1125 CALL_HEAP_FUNCTION(isolate(),
1126 isolate()->heap()->AllocateFunction( 1126 isolate()->heap()->AllocateFunction(
1127 *map, 1127 *map,
1128 *function_share, 1128 *function_share,
1129 *the_hole_value()), 1129 *the_hole_value()),
1130 JSFunction); 1130 JSFunction);
1131 } 1131 }
1132 1132
1133 1133
1134 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( 1134 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(
1135 Handle<String> name, 1135 Handle<String> name,
1136 LanguageMode language_mode) { 1136 LanguageMode language_mode) {
1137 Handle<JSFunction> fun = 1137 Handle<JSFunction> fun =
1138 NewFunctionWithoutPrototypeHelper(name, language_mode); 1138 NewFunctionWithoutPrototypeHelper(name, language_mode);
1139 fun->set_context(isolate()->context()->native_context()); 1139 fun->set_context(isolate()->context()->global_context());
1140 return fun; 1140 return fun;
1141 } 1141 }
1142 1142
1143 1143
1144 Handle<Object> Factory::ToObject(Handle<Object> object) { 1144 Handle<Object> Factory::ToObject(Handle<Object> object) {
1145 CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object); 1145 CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object);
1146 } 1146 }
1147 1147
1148 1148
1149 Handle<Object> Factory::ToObject(Handle<Object> object, 1149 Handle<Object> Factory::ToObject(Handle<Object> object,
1150 Handle<Context> native_context) { 1150 Handle<Context> global_context) {
1151 CALL_HEAP_FUNCTION(isolate(), object->ToObject(*native_context), Object); 1151 CALL_HEAP_FUNCTION(isolate(), object->ToObject(*global_context), Object);
1152 } 1152 }
1153 1153
1154 1154
1155 #ifdef ENABLE_DEBUGGER_SUPPORT 1155 #ifdef ENABLE_DEBUGGER_SUPPORT
1156 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { 1156 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
1157 // Get the original code of the function. 1157 // Get the original code of the function.
1158 Handle<Code> code(shared->code()); 1158 Handle<Code> code(shared->code());
1159 1159
1160 // Create a copy of the code before allocating the debug info object to avoid 1160 // Create a copy of the code before allocating the debug info object to avoid
1161 // allocation while setting up the debug info object. 1161 // allocation while setting up the debug info object.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 Handle<FixedArray> keys, 1313 Handle<FixedArray> keys,
1314 Handle<Map> map) { 1314 Handle<Map> map) {
1315 CALL_HEAP_FUNCTION(isolate(), 1315 CALL_HEAP_FUNCTION(isolate(),
1316 UpdateMapCacheWith(*context, *keys, *map), MapCache); 1316 UpdateMapCacheWith(*context, *keys, *map), MapCache);
1317 } 1317 }
1318 1318
1319 1319
1320 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, 1320 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
1321 Handle<FixedArray> keys) { 1321 Handle<FixedArray> keys) {
1322 if (context->map_cache()->IsUndefined()) { 1322 if (context->map_cache()->IsUndefined()) {
1323 // Allocate the new map cache for the native context. 1323 // Allocate the new map cache for the global context.
1324 Handle<MapCache> new_cache = NewMapCache(24); 1324 Handle<MapCache> new_cache = NewMapCache(24);
1325 context->set_map_cache(*new_cache); 1325 context->set_map_cache(*new_cache);
1326 } 1326 }
1327 // Check to see whether there is a matching element in the cache. 1327 // Check to see whether there is a matching element in the cache.
1328 Handle<MapCache> cache = 1328 Handle<MapCache> cache =
1329 Handle<MapCache>(MapCache::cast(context->map_cache())); 1329 Handle<MapCache>(MapCache::cast(context->map_cache()));
1330 Handle<Object> result = Handle<Object>(cache->Lookup(*keys)); 1330 Handle<Object> result = Handle<Object>(cache->Lookup(*keys));
1331 if (result->IsMap()) return Handle<Map>::cast(result); 1331 if (result->IsMap()) return Handle<Map>::cast(result);
1332 // Create a new map and add it to the cache. 1332 // Create a new map and add it to the cache.
1333 Handle<Map> map = 1333 Handle<Map> map =
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 1400
1401 1401
1402 Handle<Object> Factory::ToBoolean(bool value) { 1402 Handle<Object> Factory::ToBoolean(bool value) {
1403 return Handle<Object>(value 1403 return Handle<Object>(value
1404 ? isolate()->heap()->true_value() 1404 ? isolate()->heap()->true_value()
1405 : isolate()->heap()->false_value()); 1405 : isolate()->heap()->false_value());
1406 } 1406 }
1407 1407
1408 1408
1409 } } // namespace v8::internal 1409 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698