// Installs the contents of the native .js files on the global objects.
// Used for creating a context from scratch.
void InstallNativeFunctions();
+ void InstallExperimentalNativeFunctions();
bool InstallNatives();
bool InstallExperimentalNatives();
void InstallBuiltinFunctionIds();
INSTALL_NATIVE(JSObject, "functionCache", function_cache);
}
+void Genesis::InstallExperimentalNativeFunctions() {
+ if (FLAG_harmony_proxies) {
+ INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
+ }
+}
+
#undef INSTALL_NATIVE
if (!CompileExperimentalBuiltin(isolate(), i)) return false;
}
}
+
+ InstallExperimentalNativeFunctions();
+
return true;
}
V(STRING_ADD_LEFT, 1) \
V(STRING_ADD_RIGHT, 1) \
V(APPLY_PREPARE, 1) \
- V(APPLY_OVERFLOW, 1) \
- V(DERIVED_GET_TRAP, 2)
+ V(APPLY_OVERFLOW, 1)
class BuiltinFunctionTable;
V(OUT_OF_MEMORY_INDEX, Object, out_of_memory) \
V(MAP_CACHE_INDEX, Object, map_cache) \
V(CONTEXT_DATA_INDEX, Object, data) \
- V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings)
+ V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \
+ V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap)
// JSFunctions are pairs (context, function code), sometimes also called
// closures. A Context object is used to represent function contexts and
MAP_CACHE_INDEX,
CONTEXT_DATA_INDEX,
ALLOW_CODE_GEN_FROM_STRINGS_INDEX,
+ DERIVED_GET_TRAP_INDEX,
// Properties from here are treated as weak references by the full GC.
// Scavenge treats them as strong references.
Handle<Object> trap(v8::internal::GetProperty(handler, "get", &lookup));
if (!lookup.IsFound()) {
// Get the derived `get' property.
- Object* derived = isolate->global_context()->builtins()->javascript_builtin(
- Builtins::DERIVED_GET_TRAP);
- trap = Handle<JSFunction>(JSFunction::cast(derived));
+ trap = isolate->derived_get_trap();
}
// Call trap function.
if (!IS_SPEC_OBJECT(proto)) proto = $Object.prototype
return %CreateJSProxy(handler, proto)
}
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Builtins
+////////////////////////////////////////////////////////////////////////////////
+
+function DerivedGetTrap(receiver, name) {
+ var desc = this.getPropertyDescriptor(name)
+ if (IS_UNDEFINED(desc)) { return desc; }
+ if ('value' in desc) {
+ return desc.value
+ } else {
+ if (IS_UNDEFINED(desc.get)) { return desc.get; }
+ return desc.get.call(receiver) // The proposal says so...
+ }
+}
// that is cloned when running the code. It is essential that the
// boilerplate gets the right prototype.
%FunctionSetPrototype($Array, new $Array(0));
-
-
-/* ------------------------------------------
-- - - H a r m o n y P r o x i e s - - -
----------------------------------------------
-*/
-
-function DERIVED_GET_TRAP(receiver, name) {
- var desc = this.getPropertyDescriptor(name);
- if (IS_UNDEFINED(desc)) { return desc; }
- if ('value' in desc) {
- return desc.value;
- } else {
- if (IS_UNDEFINED(desc.get)) { return desc.get; }
- return desc.get().call(receiver); // The proposal says so...
- }
-}