Revision: 3684
Author: [email protected]
Date: Mon Jan 25 01:01:08 2010
Log: Bring a fix for v8 bug 589 and Chromium bug 27967 to 1.3.

Fixed on bleeding_edge in revision 3680.

Review URL: http://codereview.chromium.org/549132
http://code.google.com/p/v8/source/detail?r=3684

Modified:
 /branches/1.3/src/arm/ic-arm.cc
 /branches/1.3/src/ia32/ic-ia32.cc
 /branches/1.3/src/ic.h
 /branches/1.3/src/version.cc
 /branches/1.3/src/x64/ic-x64.cc
 /branches/1.3/test/cctest/test-api.cc

=======================================
--- /branches/1.3/src/arm/ic-arm.cc     Wed Oct 28 07:53:37 2009
+++ /branches/1.3/src/arm/ic-arm.cc     Mon Jan 25 01:01:08 2010
@@ -566,11 +566,10 @@

   // Get the map of the receiver.
   __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
-  // Check that the receiver does not require access checks.  We need
-  // to check this explicitly since this generic stub does not perform
-  // map checks.
+
+  // Check bit field.
   __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset));
-  __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded));
+  __ tst(r3, Operand(kSlowCaseBitFieldMask));
   __ b(ne, &slow);
   // Check that the object is some kind of JS object EXCEPT JS Value type.
   // In the case that the object is a value-wrapper object,
=======================================
--- /branches/1.3/src/ia32/ic-ia32.cc   Wed Oct 28 07:53:37 2009
+++ /branches/1.3/src/ia32/ic-ia32.cc   Mon Jan 25 01:01:08 2010
@@ -246,11 +246,10 @@

   // Get the map of the receiver.
   __ mov(edx, FieldOperand(ecx, HeapObject::kMapOffset));
-  // Check that the receiver does not require access checks.  We need
-  // to check this explicitly since this generic stub does not perform
-  // map checks.
+
+  // Check bit field.
   __ movzx_b(ebx, FieldOperand(edx, Map::kBitFieldOffset));
-  __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded));
+  __ test(ebx, Immediate(kSlowCaseBitFieldMask));
   __ j(not_zero, &slow, not_taken);
   // Check that the object is some kind of JS object EXCEPT JS Value type.
   // In the case that the object is a value-wrapper object,
=======================================
--- /branches/1.3/src/ic.h      Wed Oct 28 07:53:37 2009
+++ /branches/1.3/src/ic.h      Mon Jan 25 01:01:08 2010
@@ -280,6 +280,13 @@
   static void ClearInlinedVersion(Address address);

  private:
+  // Bit mask to be tested against bit field for the cases when
+  // generic stub should go into slow case.
+ // Access check is necessary explicitly since generic stub does not perform
+  // map checks.
+  static const int kSlowCaseBitFieldMask =
+ (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
+
   static void Generate(MacroAssembler* masm, const ExternalReference& f);

   // Update the inline cache.
=======================================
--- /branches/1.3/src/version.cc        Fri Jan 15 05:10:50 2010
+++ /branches/1.3/src/version.cc        Mon Jan 25 01:01:08 2010
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     1
 #define MINOR_VERSION     3
 #define BUILD_NUMBER      18
-#define PATCH_LEVEL       20
+#define PATCH_LEVEL       21
 #define CANDIDATE_VERSION false

 // Define SONAME to have the SCons build the put a specific SONAME into the
=======================================
--- /branches/1.3/src/x64/ic-x64.cc     Wed Nov 18 03:44:39 2009
+++ /branches/1.3/src/x64/ic-x64.cc     Mon Jan 25 01:01:08 2010
@@ -273,11 +273,10 @@
   ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
   __ CmpObjectType(rcx, JS_OBJECT_TYPE, rdx);
   __ j(below, &slow);
-  // Check that the receiver does not require access checks.  We need
-  // to check this explicitly since this generic stub does not perform
-  // map checks.  The map is already in rdx.
+
+  // Check bit field.
   __ testb(FieldOperand(rdx, Map::kBitFieldOffset),
-           Immediate(1 << Map::kIsAccessCheckNeeded));
+           Immediate(kSlowCaseBitFieldMask));
   __ j(not_zero, &slow);

   // Check that the key is a smi.
=======================================
--- /branches/1.3/test/cctest/test-api.cc       Wed Jan  6 23:49:31 2010
+++ /branches/1.3/test/cctest/test-api.cc       Mon Jan 25 01:01:08 2010
@@ -182,6 +182,32 @@

 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL;
 int RegisterThreadedTest::count_ = 0;
+
+
+// Helper function that compiles and runs the source.
+static Local<Value> CompileRun(const char* source) {
+  return Script::Compile(String::New(source))->Run();
+}
+
+static void ExpectString(const char* code, const char* expected) {
+  Local<Value> result = CompileRun(code);
+  CHECK(result->IsString());
+  String::AsciiValue ascii(result);
+  CHECK_EQ(expected, *ascii);
+}
+
+
+static void ExpectBoolean(const char* code, bool expected) {
+  Local<Value> result = CompileRun(code);
+  CHECK(result->IsBoolean());
+  CHECK_EQ(expected, result->BooleanValue());
+}
+
+
+static void ExpectObject(const char* code, Local<Value> expected) {
+  Local<Value> result = CompileRun(code);
+  CHECK(result->Equals(expected));
+}


 static int signature_callback_count;
@@ -230,11 +256,6 @@
   local_env->Exit();
 }

-
-// Helper function that compiles and runs the source.
-static Local<Value> CompileRun(const char* source) {
-  return Script::Compile(String::New(source))->Run();
-}

 THREADED_TEST(ReceiverSignature) {
   v8::HandleScope scope;
@@ -2581,6 +2602,36 @@
   result = interceptor_getter_script->Run();
   CHECK_EQ(v8_num(625), result);
 }
+
+
+static v8::Handle<Value> IdentityIndexedPropertyGetter(
+    uint32_t index,
+    const AccessorInfo& info) {
+  return v8::Integer::New(index);
+}
+
+
+THREADED_TEST(IndexedInterceptorWithNoSetter) {
+  v8::HandleScope scope;
+  Local<ObjectTemplate> templ = ObjectTemplate::New();
+  templ->SetIndexedPropertyHandler(IdentityIndexedPropertyGetter);
+
+  LocalContext context;
+  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+
+  const char* code =
+      "try {"
+      "  obj[0] = 239;"
+      "  for (var i = 0; i < 100; i++) {"
+      "    var v = obj[0];"
+      "    if (v != 0) throw 'Wrong value ' + v + ' at iteration ' + i;"
+      "  }"
+      "  'PASSED'"
+      "} catch(e) {"
+      "  e"
+      "}";
+  ExpectString(code, "PASSED");
+}


 THREADED_TEST(MultiContexts) {
@@ -2667,27 +2718,6 @@
   Local<Script> script1 = Script::Compile(source);
   CHECK_EQ(8901.0, script1->Run()->NumberValue());
 }
-
-
-static void ExpectString(const char* code, const char* expected) {
-  Local<Value> result = CompileRun(code);
-  CHECK(result->IsString());
-  String::AsciiValue ascii(result);
-  CHECK_EQ(0, strcmp(*ascii, expected));
-}
-
-
-static void ExpectBoolean(const char* code, bool expected) {
-  Local<Value> result = CompileRun(code);
-  CHECK(result->IsBoolean());
-  CHECK_EQ(expected, result->BooleanValue());
-}
-
-
-static void ExpectObject(const char* code, Local<Value> expected) {
-  Local<Value> result = CompileRun(code);
-  CHECK(result->Equals(expected));
-}


 THREADED_TEST(UndetectableObject) {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to