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

Side by Side Diff: src/factory.cc

Issue 475423003: Implement Function.prototype.toMethod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove stray change Created 6 years, 4 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 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/conversions.h" 8 #include "src/conversions.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1339 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1340 1340
1341 if (!function->shared()->is_generator()) { 1341 if (!function->shared()->is_generator()) {
1342 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); 1342 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1343 } 1343 }
1344 1344
1345 return prototype; 1345 return prototype;
1346 } 1346 }
1347 1347
1348 1348
1349 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1349 Handle<JSFunction> Factory::NewFunctionWithMapFromSharedFunctionInfo(
1350 Handle<Map> map,
1350 Handle<SharedFunctionInfo> info, 1351 Handle<SharedFunctionInfo> info,
1351 Handle<Context> context, 1352 Handle<Context> context,
1352 PretenureFlag pretenure) { 1353 PretenureFlag pretenure) {
1353 int map_index = Context::FunctionMapIndex(info->strict_mode(),
1354 info->is_generator());
1355 Handle<Map> map(Map::cast(context->native_context()->get(map_index)));
1356 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); 1354 Handle<JSFunction> result = NewFunction(map, info, context, pretenure);
1357 1355
1358 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1356 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1359 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1357 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1360 } 1358 }
1361 1359
1362 int index = info->SearchOptimizedCodeMap(context->native_context(), 1360 int index = info->SearchOptimizedCodeMap(context->native_context(),
1363 BailoutId::None()); 1361 BailoutId::None());
1364 if (!info->bound() && index < 0) { 1362 if (!info->bound() && index < 0) {
1365 int number_of_literals = info->num_literals(); 1363 int number_of_literals = info->num_literals();
(...skipping 24 matching lines...) Expand all
1390 !info->is_toplevel() && 1388 !info->is_toplevel() &&
1391 info->allows_lazy_compilation() && 1389 info->allows_lazy_compilation() &&
1392 !info->optimization_disabled() && 1390 !info->optimization_disabled() &&
1393 !isolate()->DebuggerHasBreakPoints()) { 1391 !isolate()->DebuggerHasBreakPoints()) {
1394 result->MarkForOptimization(); 1392 result->MarkForOptimization();
1395 } 1393 }
1396 return result; 1394 return result;
1397 } 1395 }
1398 1396
1399 1397
1398 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1399 Handle<SharedFunctionInfo> info,
1400 Handle<Context> context,
1401 PretenureFlag pretenure) {
1402 int map_index = Context::FunctionMapIndex(info->strict_mode(),
1403 info->is_generator());
1404 Handle<Map> map(Map::cast(context->native_context()->get(map_index)));
1405 return NewFunctionWithMapFromSharedFunctionInfo(
1406 map, info, context, pretenure);
1407 }
1408
1409
1400 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { 1410 Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
1401 Handle<FixedArray> array = NewFixedArray(length, TENURED); 1411 Handle<FixedArray> array = NewFixedArray(length, TENURED);
1402 array->set_map_no_write_barrier(*scope_info_map()); 1412 array->set_map_no_write_barrier(*scope_info_map());
1403 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); 1413 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array);
1404 return scope_info; 1414 return scope_info;
1405 } 1415 }
1406 1416
1407 1417
1408 Handle<JSObject> Factory::NewExternal(void* value) { 1418 Handle<JSObject> Factory::NewExternal(void* value) {
1409 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); 1419 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value));
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 return Handle<Object>::null(); 2389 return Handle<Object>::null();
2380 } 2390 }
2381 2391
2382 2392
2383 Handle<Object> Factory::ToBoolean(bool value) { 2393 Handle<Object> Factory::ToBoolean(bool value) {
2384 return value ? true_value() : false_value(); 2394 return value ? true_value() : false_value();
2385 } 2395 }
2386 2396
2387 2397
2388 } } // namespace v8::internal 2398 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/harmony-classes.js » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698