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

Side by Side Diff: src/factory.cc

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) Created 5 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
« no previous file with comments | « src/execution.cc ('k') | src/full-codegen.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 InitializeFunction(result, info, context); 1251 InitializeFunction(result, info, context);
1252 return result; 1252 return result;
1253 } 1253 }
1254 1254
1255 1255
1256 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1256 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1257 Handle<String> name, 1257 Handle<String> name,
1258 MaybeHandle<Code> code) { 1258 MaybeHandle<Code> code) {
1259 Handle<Context> context(isolate()->native_context()); 1259 Handle<Context> context(isolate()->native_context());
1260 Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name, code); 1260 Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name, code);
1261 DCHECK((info->strict_mode() == SLOPPY) && 1261 DCHECK(is_sloppy(info->language_mode()) &&
1262 (map.is_identical_to(isolate()->sloppy_function_map()) || 1262 (map.is_identical_to(isolate()->sloppy_function_map()) ||
1263 map.is_identical_to( 1263 map.is_identical_to(
1264 isolate()->sloppy_function_without_prototype_map()) || 1264 isolate()->sloppy_function_without_prototype_map()) ||
1265 map.is_identical_to( 1265 map.is_identical_to(
1266 isolate()->sloppy_function_with_readonly_prototype_map()))); 1266 isolate()->sloppy_function_with_readonly_prototype_map())));
1267 return NewFunction(map, info, context); 1267 return NewFunction(map, info, context);
1268 } 1268 }
1269 1269
1270 1270
1271 Handle<JSFunction> Factory::NewFunction(Handle<String> name) { 1271 Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 Handle<SharedFunctionInfo> info) { 1362 Handle<SharedFunctionInfo> info) {
1363 return isolate->use_crankshaft() && !info->is_toplevel() && 1363 return isolate->use_crankshaft() && !info->is_toplevel() &&
1364 info->is_compiled() && info->allows_lazy_compilation(); 1364 info->is_compiled() && info->allows_lazy_compilation();
1365 } 1365 }
1366 1366
1367 1367
1368 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1368 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1369 Handle<SharedFunctionInfo> info, 1369 Handle<SharedFunctionInfo> info,
1370 Handle<Context> context, 1370 Handle<Context> context,
1371 PretenureFlag pretenure) { 1371 PretenureFlag pretenure) {
1372 int map_index = Context::FunctionMapIndex(info->strict_mode(), info->kind()); 1372 int map_index =
1373 Context::FunctionMapIndex(info->language_mode(), info->kind());
1373 Handle<Map> map(Map::cast(context->native_context()->get(map_index))); 1374 Handle<Map> map(Map::cast(context->native_context()->get(map_index)));
1374 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); 1375 Handle<JSFunction> result = NewFunction(map, info, context, pretenure);
1375 1376
1376 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1377 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1377 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1378 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1378 } 1379 }
1379 1380
1380 int index = info->SearchOptimizedCodeMap(context->native_context(), 1381 int index = info->SearchOptimizedCodeMap(context->native_context(),
1381 BailoutId::None()); 1382 BailoutId::None());
1382 if (!info->bound() && index < 0) { 1383 if (!info->bound() && index < 0) {
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 2213
2213 // Link debug info to function. 2214 // Link debug info to function.
2214 shared->set_debug_info(*debug_info); 2215 shared->set_debug_info(*debug_info);
2215 2216
2216 return debug_info; 2217 return debug_info;
2217 } 2218 }
2218 2219
2219 2220
2220 Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee, 2221 Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee,
2221 int length) { 2222 int length) {
2222 bool strict_mode_callee = callee->shared()->strict_mode() == STRICT; 2223 bool strict_mode_callee = is_strict(callee->shared()->language_mode());
2223 Handle<Map> map = strict_mode_callee ? isolate()->strict_arguments_map() 2224 Handle<Map> map = strict_mode_callee ? isolate()->strict_arguments_map()
2224 : isolate()->sloppy_arguments_map(); 2225 : isolate()->sloppy_arguments_map();
2225 2226
2226 AllocationSiteUsageContext context(isolate(), Handle<AllocationSite>(), 2227 AllocationSiteUsageContext context(isolate(), Handle<AllocationSite>(),
2227 false); 2228 false);
2228 DCHECK(!isolate()->has_pending_exception()); 2229 DCHECK(!isolate()->has_pending_exception());
2229 Handle<JSObject> result = NewJSObjectFromMap(map); 2230 Handle<JSObject> result = NewJSObjectFromMap(map);
2230 Handle<Smi> value(Smi::FromInt(length), isolate()); 2231 Handle<Smi> value(Smi::FromInt(length), isolate());
2231 Object::SetProperty(result, length_string(), value, STRICT).Assert(); 2232 Object::SetProperty(result, length_string(), value, STRICT).Assert();
2232 if (!strict_mode_callee) { 2233 if (!strict_mode_callee) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 return Handle<Object>::null(); 2515 return Handle<Object>::null();
2515 } 2516 }
2516 2517
2517 2518
2518 Handle<Object> Factory::ToBoolean(bool value) { 2519 Handle<Object> Factory::ToBoolean(bool value) {
2519 return value ? true_value() : false_value(); 2520 return value ? true_value() : false_value();
2520 } 2521 }
2521 2522
2522 2523
2523 } } // namespace v8::internal 2524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698