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

Side by Side Diff: src/runtime.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 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 HandleScope scope(isolate); 2043 HandleScope scope(isolate);
2044 DCHECK(args.length() == 1); 2044 DCHECK(args.length() == 1);
2045 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 2045 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
2046 Handle<Object> result; 2046 Handle<Object> result;
2047 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2047 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2048 isolate, result, JSObject::PreventExtensions(obj)); 2048 isolate, result, JSObject::PreventExtensions(obj));
2049 return *result; 2049 return *result;
2050 } 2050 }
2051 2051
2052 2052
2053 RUNTIME_FUNCTION(Runtime_ToMethod) {
2054 HandleScope scope(isolate);
2055 DCHECK(args.length() == 2);
2056 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
2057 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
2058 Handle<JSFunction> clone = JSFunction::Copy(fun);
arv (Not doing code reviews) 2014/08/20 15:35:53 This is going to copy the properties which is not
2059 Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol());
2060 JSObject::SetOwnPropertyIgnoreAttributes(
2061 clone,
2062 home_object_symbol,
2063 home_object,
2064 DONT_SHOW).Assert();
Toon Verwaest 2014/08/20 07:43:11 DONT_ENUM. The other flags are just there for fil
2065 return *clone;
2066 }
2067
2068
2069 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) {
2070 DCHECK(args.length() == 0);
2071 return isolate->heap()->home_object_symbol();
2072 }
2073
2074
2053 RUNTIME_FUNCTION(Runtime_IsExtensible) { 2075 RUNTIME_FUNCTION(Runtime_IsExtensible) {
2054 SealHandleScope shs(isolate); 2076 SealHandleScope shs(isolate);
2055 DCHECK(args.length() == 1); 2077 DCHECK(args.length() == 1);
2056 CONVERT_ARG_CHECKED(JSObject, obj, 0); 2078 CONVERT_ARG_CHECKED(JSObject, obj, 0);
2057 if (obj->IsJSGlobalProxy()) { 2079 if (obj->IsJSGlobalProxy()) {
2058 PrototypeIterator iter(isolate, obj); 2080 PrototypeIterator iter(isolate, obj);
2059 if (iter.IsAtEnd()) return isolate->heap()->false_value(); 2081 if (iter.IsAtEnd()) return isolate->heap()->false_value();
2060 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); 2082 DCHECK(iter.GetCurrent()->IsJSGlobalObject());
2061 obj = JSObject::cast(iter.GetCurrent()); 2083 obj = JSObject::cast(iter.GetCurrent());
2062 } 2084 }
(...skipping 13586 matching lines...) Expand 10 before | Expand all | Expand 10 after
15649 } 15671 }
15650 return NULL; 15672 return NULL;
15651 } 15673 }
15652 15674
15653 15675
15654 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15676 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15655 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15677 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15656 } 15678 }
15657 15679
15658 } } // namespace v8::internal 15680 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698