Fix source property of empty RegExp objects.
R=rossberg@chromium.org BUG=v8:1982 TEST=test262/15.10.4.1-5 Review URL: https://chromiumcodereview.appspot.com/10134010 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11416 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
7d4b983f55
commit
e3be59512a
@ -1011,7 +1011,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
proto_map->set_prototype(global_context()->initial_object_prototype());
|
||||
Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map);
|
||||
proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex,
|
||||
heap->empty_string());
|
||||
heap->query_colon_symbol());
|
||||
proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex,
|
||||
heap->false_value());
|
||||
proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex,
|
||||
|
@ -243,7 +243,8 @@ namespace internal {
|
||||
V(compare_ic_symbol, ".compare_ic") \
|
||||
V(infinity_symbol, "Infinity") \
|
||||
V(minus_infinity_symbol, "-Infinity") \
|
||||
V(hidden_stack_trace_symbol, "v8::hidden_stack_trace")
|
||||
V(hidden_stack_trace_symbol, "v8::hidden_stack_trace") \
|
||||
V(query_colon_symbol, "(?:)")
|
||||
|
||||
// Forward declarations.
|
||||
class GCTracer;
|
||||
|
@ -278,11 +278,7 @@ function TrimRegExp(regexp) {
|
||||
|
||||
|
||||
function RegExpToString() {
|
||||
// If this.source is an empty string, output /(?:)/.
|
||||
// http://bugzilla.mozilla.org/show_bug.cgi?id=225550
|
||||
// ecma_2/RegExp/properties-001.js.
|
||||
var src = this.source ? this.source : '(?:)';
|
||||
var result = '/' + src + '/';
|
||||
var result = '/' + this.source + '/';
|
||||
if (this.global) result += 'g';
|
||||
if (this.ignoreCase) result += 'i';
|
||||
if (this.multiline) result += 'm';
|
||||
|
@ -1783,6 +1783,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
|
||||
ASSERT(args.length() == 5);
|
||||
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_CHECKED(String, source, 1);
|
||||
// If source is the empty string we set it to "(?:)" instead as
|
||||
// suggested by ECMA-262, 5th, section 15.10.4.1.
|
||||
if (source->length() == 0) source = isolate->heap()->query_colon_symbol();
|
||||
|
||||
Object* global = args[2];
|
||||
if (!global->IsTrue()) global = isolate->heap()->false_value();
|
||||
|
@ -30,7 +30,7 @@
|
||||
var proto = RegExp.prototype;
|
||||
assertEquals("[object RegExp]", Object.prototype.toString.call(proto));
|
||||
|
||||
assertEquals("", proto.source);
|
||||
assertEquals("(?:)", proto.source);
|
||||
assertEquals(false, proto.global);
|
||||
assertEquals(false, proto.multiline);
|
||||
assertEquals(false, proto.ignoreCase);
|
||||
|
@ -600,6 +600,12 @@ ecma_2/RegExp/hex-001: FAIL_OK
|
||||
js1_2/regexp/hexadecimal: FAIL_OK
|
||||
|
||||
|
||||
# The source field of RegExp objects is properly escaped. We match JSC.
|
||||
ecma_2/RegExp/constructor-001: FAIL_OK
|
||||
ecma_2/RegExp/function-001: FAIL_OK
|
||||
ecma_2/RegExp/properties-001: FAIL_OK
|
||||
|
||||
|
||||
##################### FAILING TESTS #####################
|
||||
|
||||
# This section is for tests that fail in V8 and pass in JSC.
|
||||
|
@ -124,6 +124,16 @@ S15.3.4.2_A1_T1: FAIL_OK
|
||||
S8.5_A2.2: PASS, FAIL if $system == linux, FAIL if $system == macos
|
||||
S8.5_A2.1: PASS, FAIL if $system == linux, FAIL if $system == macos
|
||||
|
||||
# The source field of RegExp objects is properly escaped. We match JSC.
|
||||
S15.10.4.1_A3_T1: FAIL_OK
|
||||
S15.10.4.1_A3_T2: FAIL_OK
|
||||
S15.10.4.1_A3_T3: FAIL_OK
|
||||
S15.10.4.1_A3_T4: FAIL_OK
|
||||
S15.10.4.1_A3_T5: FAIL_OK
|
||||
S15.10.4.1_A4_T2: FAIL_OK
|
||||
S15.10.4.1_A4_T3: FAIL_OK
|
||||
S15.10.4.1_A4_T5: FAIL_OK
|
||||
|
||||
##################### ES3 TESTS #########################
|
||||
# These tests check for ES3 semantics, and differ from ES5.
|
||||
# When we follow ES5 semantics, it's ok to fail the test.
|
||||
|
@ -33,9 +33,15 @@ def FAIL_OK = FAIL, OKAY
|
||||
# '__proto__' should be treated as a normal property in JSON.
|
||||
S15.12.2_A1: FAIL
|
||||
|
||||
# Sequencing of getter side effects on receiver and argument properties
|
||||
# is wrong. The receiver callback should be called before any arguments
|
||||
# are evaluated.
|
||||
# V8 Bug: http://code.google.com/p/v8/issues/detail?id=691
|
||||
11.2.3-3_3: FAIL
|
||||
|
||||
# Prototypal inheritance of properties does not maintain accessibility.
|
||||
# The [[CanPut]] operation should traverse the prototype chain to
|
||||
# determine whether given property is writable or not.
|
||||
# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1475
|
||||
8.14.4-8-b_1: FAIL
|
||||
8.14.4-8-b_2: FAIL
|
||||
@ -44,9 +50,6 @@ S15.12.2_A1: FAIL
|
||||
15.2.3.6-4-415: FAIL
|
||||
15.2.3.6-4-420: FAIL
|
||||
|
||||
# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1982
|
||||
15.10.4.1-5: FAIL
|
||||
|
||||
##################### DELIBERATE INCOMPATIBILITIES #####################
|
||||
|
||||
# We deliberately treat arguments to parseInt() with a leading zero as
|
||||
|
Loading…
Reference in New Issue
Block a user