Issue 134: instanceof operator throws illegal TypeError
http://code.google.com/p/v8/issues/detail?id=134

New issue report by polarjs:
This issue was found when testing with mozilla JS test
ecma_2/instanceof/instanceof-003.js.  Here's a reduced test case:

=== BEGIN ===

     var o = {};
     print("typeof o = " + (typeof o));

     var result = o instanceof o;
     print("o instanceof o = " + result);

=== END ===

JavaScriptCore evaluates this test code to:

typeof o = object
o instanceof o = false

v8 bleeding edge evaluates it to:

typeof o = object
native runtime.js:154: TypeError: Expecting a function in instanceof check,
but got #<an Object>
     throw %MakeTypeError('instanceof_function_expected', [V]);
     ^

According to ECMA-262 Ed.3 clause 11.8.6 says that this operator will throw
a TypeError if the right hand side argument is not an object.  In this
case, o is an object as demonstrated in the test code also.  Hence, a type
error should not be thrown here.

Also, the error message says that the error is at "native runtime.js:154".
  While the spec doesn't seem to say anything about the content of the
exception message, the message thrown by v8 in this case is misleading.
Looking at the v8 source for runtime.js at line 154 reveals nothing
relevant to this issue.  Is this an internal bug?  Should I file a separate
issue for it?

This issue was tested with v8 bleeding edge revision 643.  It was built as
follows:
> scons mode=debug library=static snapshot=off
> g++ samples/shell.cc -I include/ -I src/ -L. -lv8_g -lpthread -o jsshell






Issue attributes:
        Status: New
        Owner: ----

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to