map->set_function_with_prototype(is_constructor);
Map::SetPrototype(map, empty_function);
map->set_is_extensible(is_constructor);
- // TODO(rossberg): mark strong
+ map->set_is_strong(true);
return map;
}
macro IS_SET_ITERATOR(arg) = (%_ClassOf(arg) === 'Set Iterator');
macro IS_MAP_ITERATOR(arg) = (%_ClassOf(arg) === 'Map Iterator');
macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg));
+macro IS_STRONG(arg) = (%IsStrong(arg));
# Macro for ECMAScript 5 queries of the type:
# "Type(O) is object."
}
+void Map::set_is_strong(bool value) {
+ set_bit_field3(IsStrong::update(bit_field3(), value));
+}
+
+
+bool Map::is_strong() {
+ return IsStrong::decode(bit_field3());
+}
+
+
void Map::set_counter(int value) {
set_bit_field3(Counter::update(bit_field3(), value));
}
class Deprecated : public BitField<bool, 23, 1> {};
class IsUnstable : public BitField<bool, 24, 1> {};
class IsMigrationTarget : public BitField<bool, 25, 1> {};
- // Bits 26 and 27 are free.
+ class IsStrong : public BitField<bool, 26, 1> {};
+ // Bit 27 is free.
// Keep this bit field at the very end for better code in
// Builtins::kJSConstructStubGeneric stub.
return ((1 << kIsObserved) & bit_field()) != 0;
}
+ inline void set_is_strong(bool value);
+ inline bool is_strong();
inline void set_is_extensible(bool value);
inline bool is_extensible();
inline void set_is_prototype_map(bool value);
}
+RUNTIME_FUNCTION(Runtime_IsStrong) {
+ SealHandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_CHECKED(Object, obj, 0);
+ return isolate->heap()->ToBoolean(obj->IsJSReceiver() &&
+ JSReceiver::cast(obj)->map()->is_strong());
+}
+
+
RUNTIME_FUNCTION(Runtime_ClassOf) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
F(IsObject, 1, 1) \
F(IsUndetectableObject, 1, 1) \
F(IsSpecObject, 1, 1) \
+ F(IsStrong, 1, 1) \
F(ClassOf, 1, 1) \
F(DefineGetterPropertyUnchecked, 4, 1) \
F(DefineSetterPropertyUnchecked, 4, 1)
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --strong-mode --allow-natives-syntax
+
+'use strong';
+
+function f() {}
+assertTrue(%IsStrong(f));