Reviewers: rossberg,
Message:
This turned out to be about 10% of initialization
Description:
Avoid convertion to double when it is not needed.
[email protected]
Please review this at https://codereview.chromium.org/15162002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/runtime.cc
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
d3baaa440cf7c49a64d1d3a5baeefa0eac4e1162..7529192e2427f205c47e867707150fd2224137df
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -857,9 +857,14 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_TypedArrayInitialize) {
ASSERT(byte_length % elementSize == 0);
size_t length = byte_length / elementSize;
- Handle<Object> length_obj =
- isolate->factory()->NewNumber(static_cast<double>(length));
- holder->set_length(*length_obj);
+ if (Smi::IsValid(static_cast<intptr_t>(length))) {
+ holder->set_length(Smi::FromIntptr(length));
+ } else {
+ Handle<Object> length_obj=
+ isolate->factory()->NewNumber(static_cast<double>(length));
+ holder->set_length(*length_obj);
+ }
+
Handle<ExternalArray> elements =
isolate->factory()->NewExternalArray(
static_cast<int>(length), arrayType,
--
--
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.