Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / v8 / tools / generate-runtime-tests.py
index 18bbbbe..a41df67 100755 (executable)
@@ -20,7 +20,7 @@ import time
 FILENAME = "src/runtime.cc"
 HEADERFILENAME = "src/runtime.h"
 FUNCTION = re.compile("^RUNTIME_FUNCTION\(Runtime_(\w+)")
-ARGSLENGTH = re.compile(".*ASSERT\(.*args\.length\(\) == (\d+)\);")
+ARGSLENGTH = re.compile(".*DCHECK\(.*args\.length\(\) == (\d+)\);")
 FUNCTIONEND = "}\n"
 MACRO = re.compile(r"^#define ([^ ]+)\(([^)]*)\) *([^\\]*)\\?\n$")
 FIRST_WORD = re.compile("^\s*(.*?)[\s({\[]")
@@ -47,18 +47,18 @@ EXPAND_MACROS = [
 # that the parser doesn't bit-rot. Change the values as needed when you add,
 # remove or change runtime functions, but make sure we don't lose our ability
 # to parse them!
-EXPECTED_FUNCTION_COUNT = 373
-EXPECTED_FUZZABLE_COUNT = 335
-EXPECTED_CCTEST_COUNT = 6
-EXPECTED_UNKNOWN_COUNT = 10
-EXPECTED_BUILTINS_COUNT = 918
+EXPECTED_FUNCTION_COUNT = 428
+EXPECTED_FUZZABLE_COUNT = 331
+EXPECTED_CCTEST_COUNT = 7
+EXPECTED_UNKNOWN_COUNT = 16
+EXPECTED_BUILTINS_COUNT = 809
 
 
 # Don't call these at all.
 BLACKLISTED = [
   "Abort",  # Kills the process.
   "AbortJS",  # Kills the process.
-  "CompileForOnStackReplacement",  # Riddled with ASSERTs.
+  "CompileForOnStackReplacement",  # Riddled with DCHECK.
   "IS_VAR",  # Not implemented in the runtime.
   "ListNatives",  # Not available in Release mode.
   "SetAllocationTimeout",  # Too slow for fuzzing.
@@ -86,6 +86,91 @@ BLACKLISTED = [
   # TODO(jkummerow): Fix these and un-blacklist them!
   "CreateDateTimeFormat",
   "CreateNumberFormat",
+
+  # TODO(danno): Fix these internal function that are only callable form stubs
+  # and un-blacklist them!
+  "NumberToString",
+  "RxegExpConstructResult",
+  "RegExpExec",
+  "StringAdd",
+  "SubString",
+  "StringCompare",
+  "StringCharCodeAt",
+  "GetFromCache",
+
+  # Compilation
+  "CompileUnoptimized",
+  "CompileOptimized",
+  "TryInstallOptimizedCode",
+  "NotifyDeoptimized",
+  "NotifyStubFailure",
+
+  # Utilities
+  "AllocateInNewSpace",
+  "AllocateInTargetSpace",
+  "AllocateHeapNumber",
+  "NumberToSmi",
+  "NumberToStringSkipCache",
+
+  "NewSloppyArguments",
+  "NewStrictArguments",
+
+  # Harmony
+  "CreateJSGeneratorObject",
+  "SuspendJSGeneratorObject",
+  "ResumeJSGeneratorObject",
+  "ThrowGeneratorStateError",
+
+  # Arrays
+  "ArrayConstructor",
+  "InternalArrayConstructor",
+  "NormalizeElements",
+
+  # Literals
+  "MaterializeRegExpLiteral",
+  "CreateObjectLiteral",
+  "CreateArrayLiteral",
+  "CreateArrayLiteralStubBailout",
+
+  # Statements
+  "NewClosure",
+  "NewClosureFromStubFailure",
+  "NewObject",
+  "NewObjectWithAllocationSite",
+  "FinalizeInstanceSize",
+  "Throw",
+  "ReThrow",
+  "ThrowReferenceError",
+  "ThrowNotDateError",
+  "StackGuard",
+  "Interrupt",
+  "PromoteScheduledException",
+
+  # Contexts
+  "NewGlobalContext",
+  "NewFunctionContext",
+  "PushWithContext",
+  "PushCatchContext",
+  "PushBlockContext",
+  "PushModuleContext",
+  "DeleteLookupSlot",
+  "LoadLookupSlot",
+  "LoadLookupSlotNoReferenceError",
+  "StoreLookupSlot",
+
+  # Declarations
+  "DeclareGlobals",
+  "DeclareModules",
+  "DeclareContextSlot",
+  "InitializeConstGlobal",
+  "InitializeConstContextSlot",
+
+  # Eval
+  "ResolvePossiblyDirectEval",
+
+  # Maths
+  "MathPowSlow",
+  "MathPowRT"
 ]
 
 
@@ -127,6 +212,8 @@ _NUMBER_FORMAT = (
 # Format: "FunctionName": ["arg0", "arg1", ..., argslength].
 # None means "fall back to autodetected value".
 CUSTOM_KNOWN_GOOD_INPUT = {
+  "AddNamedProperty": [None, "\"bla\"", None, None, None],
+  "AddPropertyForTemplate": [None, 10, None, None, None],
   "Apply": ["function() {}", None, None, None, None, None],
   "ArrayBufferSliceImpl": [None, None, 0, None],
   "ArrayConcat": ["[1, 'a']", None],
@@ -141,8 +228,8 @@ CUSTOM_KNOWN_GOOD_INPUT = {
   "CreatePrivateSymbol": ["\"foo\"", None],
   "CreateSymbol": ["\"foo\"", None],
   "DateParseString": [None, "new Array(8)", None],
-  "DefineOrRedefineAccessorProperty": [None, None, "function() {}",
-                                       "function() {}", 2, None],
+  "DefineAccessorPropertyUnchecked": [None, None, "function() {}",
+                                      "function() {}", 2, None],
   "FunctionBindArguments": [None, None, "undefined", None, None],
   "GetBreakLocations": [None, 0, None],
   "GetDefaultReceiver": ["function() {}", None],
@@ -158,11 +245,10 @@ CUSTOM_KNOWN_GOOD_INPUT = {
   "NumberToRadixString": [None, "2", None],
   "ParseJson": ["\"{}\"", 1],
   "RegExpExecMultiple": [None, None, "['a']", "['a']", None],
-  "SetAccessorProperty": [None, None, "undefined", "undefined", None, None,
-                          None],
+  "DefineApiAccessorProperty": [None, None, "undefined", "undefined", None, None],
   "SetIteratorInitialize": [None, None, "2", None],
   "SetDebugEventListener": ["undefined", None, None],
-  "SetFunctionBreakPoint": [None, 200, None, None],
+  "SetFunctionBreakPoint": [None, 218, None, None],
   "StringBuilderConcat": ["[1, 2, 3]", 3, None, None],
   "StringBuilderJoin": ["['a', 'b']", 4, None, None],
   "StringMatch": [None, None, "['a', 'b']", None],
@@ -171,6 +257,7 @@ CUSTOM_KNOWN_GOOD_INPUT = {
   "TypedArrayInitialize": [None, 6, "new ArrayBuffer(8)", None, 4, None],
   "TypedArrayInitializeFromArrayLike": [None, 6, None, None, None],
   "TypedArraySetFastCases": [None, None, "0", None],
+  "FunctionIsArrow": ["() => null", None],
 }
 
 
@@ -457,25 +544,6 @@ class Generator(object):
                              fallback="new DataView(new ArrayBuffer(8))")
     return result
 
-  def _Float32x4(self, name, recursion_budget):
-    x = random.random()
-    y = random.random()
-    z = random.random()
-    w = random.random()
-    return self._Variable(name, "SIMD.float32x4(%s, %s, %s, %s)" %(x, y, z, w))
-
-  def _Float64x2(self, name, recursion_budget):
-    x = random.random()
-    y = random.random()
-    return self._Variable(name, "SIMD.float64x2(%s, %s)" %(x, y))
-
-  def _Int32x4(self, name, recursion_budget):
-    x = random.randint(-0x40000000, 0x3fffffff)
-    y = random.randint(-0x40000000, 0x3fffffff)
-    z = random.randint(-0x40000000, 0x3fffffff)
-    w = random.randint(-0x40000000, 0x3fffffff)
-    return self._Variable(name, "SIMD.int32x4(%s, %s, %s, %s)" %(x, y, z, w))
-
   def _JSDate(self, name, recursion_budget):
     die = random.random()
     if die < 0.25:
@@ -708,9 +776,6 @@ class Generator(object):
     "String": ["\"foo\"", _String],
     "Symbol": ["Symbol(\"symbol\")", _Symbol],
     "Uint32": ["32", _Uint32],
-    "Float32x4": ["SIMD.float32x4(0.0, 0.0, 0.0, 0.0)", _Float32x4],
-    "Float64x2": ["SIMD.float64x2(0.0, 0.0)", _Float64x2],
-    "Int32x4": ["SIMD.int32x4(0, 0, 0, 0)", _Int32x4],
   }
 
 
@@ -1067,11 +1132,8 @@ def _GetKnownGoodArgs(function, generator):
 def _GenerateTestcase(function, definitions, argslist, throws):
   s = ["// Copyright 2014 the V8 project authors. All rights reserved.",
        "// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY",
-       "// Flags: --allow-natives-syntax --harmony"] + definitions
-  if function.name.find("Float32x4") != -1 or function.name.find("Float64x2") != -1 or function.name.find("Int32x4") != -1:
-    s = ["// Copyright 2014 the V8 project authors. All rights reserved.",
-        "// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY",
-        "// Flags: --allow-natives-syntax --harmony --simd-object"] + definitions
+       "// Flags: --allow-natives-syntax --harmony --harmony-proxies"
+      ] + definitions
   call = "%%%s%s(%s);" % (function.inline, function.name, ", ".join(argslist))
   if throws:
     s.append("try {")
@@ -1151,7 +1213,7 @@ def RunFuzzer(process_id, options, stop_running):
         with open(stderr_file_name, "w") as stderr:
           process = subprocess.Popen(
               [options.binary, "--allow-natives-syntax", "--harmony",
-               "--enable-slow-asserts", test_file_name],
+               "--harmony-proxies", "--enable-slow-asserts", test_file_name],
               stdout=devnull, stderr=stderr)
           end_time = time.time() + options.timeout
           timed_out = False