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

Side by Side Diff: src/factory.cc

Issue 8199004: Reimplement Function.prototype.bind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 2 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/arm/macro-assembler-arm.cc ('k') | src/heap.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 Handle<Context> context, 490 Handle<Context> context,
491 PretenureFlag pretenure) { 491 PretenureFlag pretenure) {
492 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( 492 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo(
493 function_info, 493 function_info,
494 function_info->strict_mode() 494 function_info->strict_mode()
495 ? isolate()->strict_mode_function_map() 495 ? isolate()->strict_mode_function_map()
496 : isolate()->function_map(), 496 : isolate()->function_map(),
497 pretenure); 497 pretenure);
498 498
499 result->set_context(*context); 499 result->set_context(*context);
500 int number_of_literals = function_info->num_literals(); 500 if (!function_info->bound()) {
501 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); 501 int number_of_literals = function_info->num_literals();
502 if (number_of_literals > 0) { 502 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
503 // Store the object, regexp and array functions in the literals 503 if (number_of_literals > 0) {
504 // array prefix. These functions will be used when creating 504 // Store the object, regexp and array functions in the literals
505 // object, regexp and array literals in this function. 505 // array prefix. These functions will be used when creating
506 literals->set(JSFunction::kLiteralGlobalContextIndex, 506 // object, regexp and array literals in this function.
507 context->global_context()); 507 literals->set(JSFunction::kLiteralGlobalContextIndex,
508 context->global_context());
509 }
510 result->set_literals(*literals);
511 } else {
512 result->set_function_bindings(isolate()->heap()->empty_fixed_array());
508 } 513 }
509 result->set_literals(*literals);
510 result->set_next_function_link(isolate()->heap()->undefined_value()); 514 result->set_next_function_link(isolate()->heap()->undefined_value());
511 515
512 if (V8::UseCrankshaft() && 516 if (V8::UseCrankshaft() &&
513 FLAG_always_opt && 517 FLAG_always_opt &&
514 result->is_compiled() && 518 result->is_compiled() &&
515 !function_info->is_toplevel() && 519 !function_info->is_toplevel() &&
516 function_info->allows_lazy_compilation()) { 520 function_info->allows_lazy_compilation()) {
517 result->MarkForLazyRecompilation(); 521 result->MarkForLazyRecompilation();
518 } 522 }
519 return result; 523 return result;
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 1341
1338 1342
1339 Handle<Object> Factory::ToBoolean(bool value) { 1343 Handle<Object> Factory::ToBoolean(bool value) {
1340 return Handle<Object>(value 1344 return Handle<Object>(value
1341 ? isolate()->heap()->true_value() 1345 ? isolate()->heap()->true_value()
1342 : isolate()->heap()->false_value()); 1346 : isolate()->heap()->false_value());
1343 } 1347 }
1344 1348
1345 1349
1346 } } // namespace v8::internal 1350 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698