Reviewers: Dmitry Lomov (chromium),
Description:
Use %_IsSmi instead of %MaxSmi.
ToPositiveInteger already makes sure that if l can be represented as a
smi, it will be represented as a smi. This way we can avoid doing a
runtime call to retrieve a constant.
[email protected]
Please review this at https://codereview.chromium.org/81063002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+3, -10 lines):
M src/runtime.h
M src/runtime.cc
M src/typedarray.js
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
c11a00528d02e37bce4826d5cf180bf85c795b78..48e3bbca76e64166330c41d90da5d65f77083b28
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -14806,11 +14806,6 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_InternalArrayConstructor) {
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_MaxSmi) {
- return Smi::FromInt(Smi::kMaxValue);
-}
-
-
//
----------------------------------------------------------------------------
// Implementation of Runtime
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index
43d4065615fb66fe763afcef984253a7fd444051..6917170a0efa26e50d7fda07f364367164304c1c
100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -112,7 +112,6 @@ namespace internal {
F(FlattenString, 1, 1) \
F(MigrateInstance, 1, 1) \
F(NotifyContextDisposed, 0, 1) \
- F(MaxSmi, 0, 1) \
\
/* Array join support */ \
F(PushIfAbsent, 2, 1) \
Index: src/typedarray.js
diff --git a/src/typedarray.js b/src/typedarray.js
index
fc3a608f46ff83afd30b4b1108ac1f24e2419602..4c43391e63c4a72da8f5020d3be407191653d650
100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -86,8 +86,8 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME,
ELEMENT_SIZE)
function NAMEConstructByLength(obj, length) {
var l = IS_UNDEFINED(length) ?
- 0 : ToPositiveInteger(length, "invalid_typed_array_length");
- if (l > %MaxSmi()) {
+ 0 : ToPositiveInteger(length, "invalid_typed_array_length");
+ if (!%_IsSmi(l)) {
throw MakeRangeError("invalid_typed_array_length");
}
var byteLength = l * ELEMENT_SIZE;
@@ -98,7 +98,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME,
ELEMENT_SIZE)
function NAMEConstructByArrayLike(obj, arrayLike) {
var length = arrayLike.length;
var l = ToPositiveInteger(length, "invalid_typed_array_length");
- if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
+ if (!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
for (var i = 0; i < l; i++) {
// It is crucial that we let any execptions from arrayLike[i]
// propagate outside the function.
@@ -108,7 +108,6 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME,
ELEMENT_SIZE)
}
function NAMEConstructor(arg1, arg2, arg3) {
-
if (%_IsConstructCall()) {
if (IS_ARRAYBUFFER(arg1)) {
NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.