Index: src/ia32/codegen-ia32.cc |
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc |
index 58eead772b067f9c5f550b0b53b2d18ba9d90f92..33cf7b1970fd9b70f470d651a24ca32afef87ccc 100644 |
--- a/src/ia32/codegen-ia32.cc |
+++ b/src/ia32/codegen-ia32.cc |
@@ -563,15 +563,17 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
__ Assert(zero, "external string expected, but not found"); |
} |
__ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset)); |
- // Assert that the external string has not been finalized yet. |
- __ test(result, result); |
- __ j(zero, call_runtime); |
Register scratch = string; |
__ mov(scratch, FieldOperand(string, HeapObject::kMapOffset)); |
- __ cmp(scratch, Immediate(factory->external_ascii_string_map())); |
- __ j(equal, &ascii_external, Label::kNear); |
- __ cmp(scratch, Immediate(factory->external_ascii_symbol_map())); |
- __ j(equal, &ascii_external, Label::kNear); |
+ __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); |
+ // Rule out short external strings. |
+ STATIC_CHECK(kShortExternalStringTag != 0); |
+ __ test_b(scratch, kShortExternalStringTag); |
Lasse Reichstein
2011/11/23 08:43:20
Test with kShortExternalStringMask instead of ...T
Yang
2011/11/23 09:58:48
Done.
|
+ __ j(not_zero, call_runtime); |
+ // Check encoding. |
+ STATIC_ASSERT(kTwoByteStringTag == 0); |
+ __ test_b(scratch, kStringEncodingMask); |
+ __ j(not_equal, &ascii_external, Label::kNear); |
// Two-byte string. |
__ movzx_w(result, Operand(result, index, times_2, 0)); |
__ jmp(&done); |