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

Side by Side Diff: src/objects.h

Issue 1871503002: Lazily compute boundfunction .name and .length if possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Created 4 years, 8 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/factory.cc ('k') | src/objects.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 7364 matching lines...) Expand 10 before | Expand all | Expand 10 after
7375 static const int kSize = kScopeInfoOffset + kPointerSize; 7375 static const int kSize = kScopeInfoOffset + kPointerSize;
7376 7376
7377 private: 7377 private:
7378 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule); 7378 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule);
7379 }; 7379 };
7380 7380
7381 7381
7382 // JSBoundFunction describes a bound function exotic object. 7382 // JSBoundFunction describes a bound function exotic object.
7383 class JSBoundFunction : public JSObject { 7383 class JSBoundFunction : public JSObject {
7384 public: 7384 public:
7385 // [length]: The bound function "length" property.
7386 DECL_ACCESSORS(length, Object)
7387
7388 // [name]: The bound function "name" property.
7389 DECL_ACCESSORS(name, Object)
7390
7391 // [bound_target_function]: The wrapped function object. 7385 // [bound_target_function]: The wrapped function object.
7392 DECL_ACCESSORS(bound_target_function, JSReceiver) 7386 DECL_ACCESSORS(bound_target_function, JSReceiver)
7393 7387
7394 // [bound_this]: The value that is always passed as the this value when 7388 // [bound_this]: The value that is always passed as the this value when
7395 // calling the wrapped function. 7389 // calling the wrapped function.
7396 DECL_ACCESSORS(bound_this, Object) 7390 DECL_ACCESSORS(bound_this, Object)
7397 7391
7398 // [bound_arguments]: A list of values whose elements are used as the first 7392 // [bound_arguments]: A list of values whose elements are used as the first
7399 // arguments to any call to the wrapped function. 7393 // arguments to any call to the wrapped function.
7400 DECL_ACCESSORS(bound_arguments, FixedArray) 7394 DECL_ACCESSORS(bound_arguments, FixedArray)
7401 7395
7396 static MaybeHandle<String> GetName(Isolate* isolate,
7397 Handle<JSBoundFunction> function);
7402 static MaybeHandle<Context> GetFunctionRealm( 7398 static MaybeHandle<Context> GetFunctionRealm(
7403 Handle<JSBoundFunction> function); 7399 Handle<JSBoundFunction> function);
7404 7400
7405 DECLARE_CAST(JSBoundFunction) 7401 DECLARE_CAST(JSBoundFunction)
7406 7402
7407 // Dispatched behavior. 7403 // Dispatched behavior.
7408 DECLARE_PRINTER(JSBoundFunction) 7404 DECLARE_PRINTER(JSBoundFunction)
7409 DECLARE_VERIFIER(JSBoundFunction) 7405 DECLARE_VERIFIER(JSBoundFunction)
7410 7406
7411 // The bound function's string representation implemented according 7407 // The bound function's string representation implemented according
7412 // to ES6 section 19.2.3.5 Function.prototype.toString ( ). 7408 // to ES6 section 19.2.3.5 Function.prototype.toString ( ).
7413 static Handle<String> ToString(Handle<JSBoundFunction> function); 7409 static Handle<String> ToString(Handle<JSBoundFunction> function);
7414 7410
7415 // Layout description. 7411 // Layout description.
7416 static const int kBoundTargetFunctionOffset = JSObject::kHeaderSize; 7412 static const int kBoundTargetFunctionOffset = JSObject::kHeaderSize;
7417 static const int kBoundThisOffset = kBoundTargetFunctionOffset + kPointerSize; 7413 static const int kBoundThisOffset = kBoundTargetFunctionOffset + kPointerSize;
7418 static const int kBoundArgumentsOffset = kBoundThisOffset + kPointerSize; 7414 static const int kBoundArgumentsOffset = kBoundThisOffset + kPointerSize;
7419 static const int kLengthOffset = kBoundArgumentsOffset + kPointerSize; 7415 static const int kSize = kBoundArgumentsOffset + kPointerSize;
7420 static const int kNameOffset = kLengthOffset + kPointerSize;
7421 static const int kSize = kNameOffset + kPointerSize;
7422
7423 // Indices of in-object properties.
7424 static const int kLengthIndex = 0;
7425 static const int kNameIndex = 1;
7426 7416
7427 private: 7417 private:
7428 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBoundFunction); 7418 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBoundFunction);
7429 }; 7419 };
7430 7420
7431 7421
7432 // JSFunction describes JavaScript functions. 7422 // JSFunction describes JavaScript functions.
7433 class JSFunction: public JSObject { 7423 class JSFunction: public JSObject {
7434 public: 7424 public:
7435 // [prototype_or_initial_map]: 7425 // [prototype_or_initial_map]:
7436 DECL_ACCESSORS(prototype_or_initial_map, Object) 7426 DECL_ACCESSORS(prototype_or_initial_map, Object)
7437 7427
7438 // [shared]: The information about the function that 7428 // [shared]: The information about the function that
7439 // can be shared by instances. 7429 // can be shared by instances.
7440 DECL_ACCESSORS(shared, SharedFunctionInfo) 7430 DECL_ACCESSORS(shared, SharedFunctionInfo)
7441 7431
7442 // [context]: The context for this function. 7432 // [context]: The context for this function.
7443 inline Context* context(); 7433 inline Context* context();
7444 inline void set_context(Object* context); 7434 inline void set_context(Object* context);
7445 inline JSObject* global_proxy(); 7435 inline JSObject* global_proxy();
7446 inline Context* native_context(); 7436 inline Context* native_context();
7447 7437
7438 static Handle<Object> GetName(Isolate* isolate, Handle<JSFunction> function);
7439 static MaybeHandle<Smi> GetLength(Isolate* isolate,
7440 Handle<JSFunction> function);
7448 static Handle<Context> GetFunctionRealm(Handle<JSFunction> function); 7441 static Handle<Context> GetFunctionRealm(Handle<JSFunction> function);
7449 7442
7450 // [code]: The generated code object for this function. Executed 7443 // [code]: The generated code object for this function. Executed
7451 // when the function is invoked, e.g. foo() or new foo(). See 7444 // when the function is invoked, e.g. foo() or new foo(). See
7452 // [[Call]] and [[Construct]] description in ECMA-262, section 7445 // [[Call]] and [[Construct]] description in ECMA-262, section
7453 // 8.6.2, page 27. 7446 // 8.6.2, page 27.
7454 inline Code* code(); 7447 inline Code* code();
7455 inline void set_code(Code* code); 7448 inline void set_code(Code* code);
7456 inline void set_code_no_write_barrier(Code* code); 7449 inline void set_code_no_write_barrier(Code* code);
7457 inline void ReplaceCode(Code* code); 7450 inline void ReplaceCode(Code* code);
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after
10767 } 10760 }
10768 return value; 10761 return value;
10769 } 10762 }
10770 }; 10763 };
10771 10764
10772 10765
10773 } // NOLINT, false-positive due to second-order macros. 10766 } // NOLINT, false-positive due to second-order macros.
10774 } // NOLINT, false-positive due to second-order macros. 10767 } // NOLINT, false-positive due to second-order macros.
10775 10768
10776 #endif // V8_OBJECTS_H_ 10769 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698