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

Side by Side Diff: src/builtins.cc

Issue 1540953004: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typos. Created 5 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 } 1770 }
1771 Handle<JSReceiver> receiver = args.at<JSReceiver>(0); 1771 Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
1772 Handle<Object> hint = args.at<Object>(1); 1772 Handle<Object> hint = args.at<Object>(1);
1773 Handle<Object> result; 1773 Handle<Object> result;
1774 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 1774 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
1775 JSDate::ToPrimitive(receiver, hint)); 1775 JSDate::ToPrimitive(receiver, hint));
1776 return *result; 1776 return *result;
1777 } 1777 }
1778 1778
1779 1779
1780 // ES6 section 19.2.3.5 Function.prototype.toString ( )
1781 BUILTIN(FunctionPrototypeToString) {
1782 HandleScope scope(isolate);
1783 Handle<Object> receiver = args.receiver();
1784
1785 if (receiver->IsJSFunction()) {
1786 return *JSFunction::ToString(Handle<JSFunction>::cast(receiver));
1787 }
1788 THROW_NEW_ERROR_RETURN_FAILURE(
1789 isolate, NewTypeError(MessageTemplate::kNotGeneric,
1790 isolate->factory()->NewStringFromAsciiChecked(
1791 "Function.prototype.toString")));
1792 }
1793
1794
1780 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. 1795 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
1781 BUILTIN(SymbolConstructor) { 1796 BUILTIN(SymbolConstructor) {
1782 HandleScope scope(isolate); 1797 HandleScope scope(isolate);
1783 DCHECK_EQ(2, args.length()); 1798 DCHECK_EQ(2, args.length());
1784 Handle<Symbol> result = isolate->factory()->NewSymbol(); 1799 Handle<Symbol> result = isolate->factory()->NewSymbol();
1785 Handle<Object> description = args.at<Object>(1); 1800 Handle<Object> description = args.at<Object>(1);
1786 if (!description->IsUndefined()) { 1801 if (!description->IsUndefined()) {
1787 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description, 1802 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
1788 Object::ToString(isolate, description)); 1803 Object::ToString(isolate, description));
1789 result->set_name(*description); 1804 result->set_name(*description);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2521 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2507 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2522 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2508 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2523 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2509 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2524 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2510 #undef DEFINE_BUILTIN_ACCESSOR_C 2525 #undef DEFINE_BUILTIN_ACCESSOR_C
2511 #undef DEFINE_BUILTIN_ACCESSOR_A 2526 #undef DEFINE_BUILTIN_ACCESSOR_A
2512 2527
2513 2528
2514 } // namespace internal 2529 } // namespace internal
2515 } // namespace v8 2530 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/debug/mirrors.js » ('j') | src/debug/mirrors.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698