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

Unified Diff: src/runtime.cc

Issue 7911: Various API changes (Closed)
Patch Set: "Various API changes Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index b7e3ad93c02ab0c2b87168872249a530b025d5f4..35aa3e77618165962d5c352c666b4335462299b7 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -221,53 +221,46 @@ static Object* Runtime_ClassOf(Arguments args) {
return JSObject::cast(obj)->class_name();
}
-inline static Object* HasSpecificClassOf(Arguments args, String* name) {
- NoHandleAllocation ha;
- ASSERT(args.length() == 1);
- Object* obj = args[0];
- if (obj->IsJSObject() && (JSObject::cast(obj)->class_name() == name)) {
- return Heap::true_value();
- }
- return Heap::false_value();
-}
static Object* Runtime_HasStringClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::String_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::String_symbol()));
}
static Object* Runtime_HasDateClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::Date_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::Date_symbol()));
}
static Object* Runtime_HasArrayClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::Array_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::Array_symbol()));
}
static Object* Runtime_HasFunctionClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::function_class_symbol());
+ return Heap::ToBoolean(
+ args[0]->HasSpecificClassOf(Heap::function_class_symbol()));
}
static Object* Runtime_HasNumberClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::Number_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::Number_symbol()));
}
static Object* Runtime_HasBooleanClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::Boolean_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::Boolean_symbol()));
}
static Object* Runtime_HasArgumentsClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::Arguments_symbol());
+ return Heap::ToBoolean(
+ args[0]->HasSpecificClassOf(Heap::Arguments_symbol()));
}
static Object* Runtime_HasRegExpClass(Arguments args) {
- return HasSpecificClassOf(args, Heap::RegExp_symbol());
+ return Heap::ToBoolean(args[0]->HasSpecificClassOf(Heap::RegExp_symbol()));
}
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698