X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Fruntime.js;h=706b99d47b283f60a7fd3c4c8dfc60f15660bff7;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=d2293da5fa2c4568ebaac43b82dbe594503388f9;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/runtime.js b/src/v8/src/runtime.js index d2293da..706b99d 100644 --- a/src/v8/src/runtime.js +++ b/src/v8/src/runtime.js @@ -1,29 +1,6 @@ // Copyright 2006-2008 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. // This files contains runtime support implemented in JavaScript. @@ -72,7 +49,7 @@ function EQUALS(y) { if (IS_NUMBER(y)) return %NumberEquals(%ToNumber(x), y); if (IS_BOOLEAN(y)) return %NumberEquals(%ToNumber(x), %ToNumber(y)); if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal - if (IsFloat32x4(y) || IsInt32x4(y)) { + if (IsFloat32x4(y) || IsFloat64x2(y) || IsInt32x4(y)) { return %StringEquals(x, %ToString(y)); } y = %ToPrimitive(y, NO_HINT); @@ -92,6 +69,18 @@ function EQUALS(y) { if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal y = %ToPrimitive(y, NO_HINT); } + } else if (IsFloat64x2(x)) { + while (true) { + if (IsFloat64x2(y)) { + return (x.x == y.x && x.y == y.y) ? 0 : 1; + } + if (IS_STRING(y)) return %StringEquals(%ToString(x), y); + if (IS_NUMBER(y)) return 1; // not equal + if (IS_SYMBOL(y)) return 1; // not equal + if (IS_BOOLEAN(y)) return y ? 0 : 1; + if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal + y = %ToPrimitive(y, NO_HINT); + } } else if (IsInt32x4(x)) { while (true) { if (IsFloat32x4(y) || IsInt32x4(y)) { @@ -110,7 +99,7 @@ function EQUALS(y) { if (IS_NUMBER(y)) return %NumberEquals(%ToNumber(x), y); if (IS_STRING(y)) return %NumberEquals(%ToNumber(x), %ToNumber(y)); if (IS_SYMBOL(y)) return 1; // not equal - if (IsFloat32x4(y) || IsInt32x4(y)) return x ? 0 : 1; + if (IsFloat32x4(y) || IsFloat64x2(y) || IsInt32x4(y)) return x ? 0 : 1; // y is object. x = %ToNumber(x); y = %ToPrimitive(y, NO_HINT); @@ -147,6 +136,11 @@ function STRICT_EQUALS(x) { this.z == x.z && this.w == x.w) ? 0 : 1; } + if (IsFloat64x2(this)) { + if (!IsFloat64x2(x)) return 1; // not equal + return (this.x == x.x && this.y == x.y) ? 0 : 1; + } + if (IsInt32x4(this)) { if (!IsInt32x4(x)) return 1; // not equal return (this.x == x.x && this.y == x.y && @@ -203,6 +197,16 @@ function COMPARE(x, ncr) { (left.z > right.z) && (left.w > right.w)) { return 1; // great } + } else if (IsFloat64x2(left) && IsFloat64x2(right)) { + if ((left.x == right.x) && (left.y == right.y)) { + return 0; // equal + } + if ((left.x < right.x) && (left.y < right.y)) { + return -1; // less + } + if ((left.x > right.x) && (left.y > right.y)) { + return 1; // great + } } else { var left_number = %ToNumber(left); var right_number = %ToNumber(right); @@ -518,7 +522,7 @@ function APPLY_PREPARE(args) { } -function APPLY_OVERFLOW(length) { +function STACK_OVERFLOW(length) { throw %MakeRangeError('stack_overflow', []); } @@ -580,6 +584,7 @@ function ToNumber(x) { if (IS_UNDEFINED(x)) return NAN; if (IS_SYMBOL(x)) return NAN; if (IsFloat32x4(x)) return NAN; + if (IsFloat64x2(x)) return NAN; if (IsInt32x4(x)) return NAN; return (IS_NULL(x)) ? 0 : ToNumber(%DefaultNumber(x)); } @@ -593,6 +598,7 @@ function NonNumberToNumber(x) { if (IS_UNDEFINED(x)) return NAN; if (IS_SYMBOL(x)) return NAN; if (IsFloat32x4(x)) return NAN; + if (IsFloat64x2(x)) return NAN; if (IsInt32x4(x)) return NAN; return (IS_NULL(x)) ? 0 : ToNumber(%DefaultNumber(x)); } @@ -629,6 +635,7 @@ function ToObject(x) { if (IS_NUMBER(x)) return new $Number(x); if (IS_BOOLEAN(x)) return new $Boolean(x); if (IsFloat32x4(x)) return new $Float32x4(x.x, x.y, x.z, x.w); + if (IsFloat64x2(x)) return new $Float64x2(x.x, x.y); if (IsInt32x4(x)) return new $Int32x4(x.x, x.y, x.z, x.w); if (IS_SYMBOL(x)) return %NewSymbolWrapper(x); if (IS_NULL_OR_UNDEFINED(x) && !IS_UNDETECTABLE(x)) {