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

Unified Diff: src/runtime/runtime-test.cc

Issue 612023002: Split even more runtime functions into separate files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/runtime/runtime-liveedit.cc ('k') | src/runtime/runtime-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index eac3c613af910ca7fa4e61909324d21d06612031..9e4e4346039f9f5289e95a52814721ada9641ba7 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -292,6 +292,61 @@ RUNTIME_FUNCTION(Runtime_AbortJS) {
}
+// Returns V8 version as a string.
+RUNTIME_FUNCTION(Runtime_GetV8Version) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 0);
+
+ const char* version_string = v8::V8::GetVersion();
+
+ return *isolate->factory()->NewStringFromAsciiChecked(version_string);
+}
+
+
+#ifdef DEBUG
+// ListNatives is ONLY used by the fuzz-natives.js in debug mode
+// Exclude the code in release mode.
+RUNTIME_FUNCTION(Runtime_ListNatives) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 0);
+#define COUNT_ENTRY(Name, argc, ressize) +1
+ int entry_count =
+ 0 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) INLINE_FUNCTION_LIST(COUNT_ENTRY)
+ INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY);
+#undef COUNT_ENTRY
+ Factory* factory = isolate->factory();
+ Handle<FixedArray> elements = factory->NewFixedArray(entry_count);
+ int index = 0;
+ bool inline_runtime_functions = false;
+#define ADD_ENTRY(Name, argc, ressize) \
+ { \
+ HandleScope inner(isolate); \
+ Handle<String> name; \
+ /* Inline runtime functions have an underscore in front of the name. */ \
+ if (inline_runtime_functions) { \
+ name = factory->NewStringFromStaticChars("_" #Name); \
+ } else { \
+ name = factory->NewStringFromStaticChars(#Name); \
+ } \
+ Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \
+ pair_elements->set(0, *name); \
+ pair_elements->set(1, Smi::FromInt(argc)); \
+ Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \
+ elements->set(index++, *pair); \
+ }
+ inline_runtime_functions = false;
+ RUNTIME_FUNCTION_LIST(ADD_ENTRY)
+ INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY)
+ inline_runtime_functions = true;
+ INLINE_FUNCTION_LIST(ADD_ENTRY)
+#undef ADD_ENTRY
+ DCHECK_EQ(index, entry_count);
+ Handle<JSArray> result = factory->NewJSArrayWithElements(elements);
+ return *result;
+}
+#endif
+
+
RUNTIME_FUNCTION(Runtime_HaveSameMap) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 2);
@@ -319,5 +374,27 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
#undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION
+
+
+#define TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, size) \
+ RUNTIME_FUNCTION(Runtime_HasExternal##Type##Elements) { \
+ CONVERT_ARG_CHECKED(JSObject, obj, 0); \
+ return isolate->heap()->ToBoolean(obj->HasExternal##Type##Elements()); \
+ }
+
+TYPED_ARRAYS(TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION)
+
+#undef TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
+
+
+#define FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, s) \
+ RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \
+ CONVERT_ARG_CHECKED(JSObject, obj, 0); \
+ return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \
+ }
+
+TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION)
+
+#undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
}
} // namespace v8::internal
« no previous file with comments | « src/runtime/runtime-liveedit.cc ('k') | src/runtime/runtime-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698