mirror of https://github.com/lukechilds/node.git
isaacs
13 years ago
192 changed files with 4208 additions and 7189 deletions
@ -1,27 +0,0 @@ |
|||
# Note: The buildbots evaluate this file with CWD set to the parent |
|||
# directory and assume that the root of the checkout is in ./v8/, so |
|||
# all paths in here must match this assumption. |
|||
|
|||
deps = { |
|||
# Remember to keep the revision in sync with the Makefile. |
|||
"v8/build/gyp": |
|||
"http://gyp.googlecode.com/svn/trunk@1282", |
|||
} |
|||
|
|||
deps_os = { |
|||
"win": { |
|||
"v8/third_party/cygwin": |
|||
"http://src.chromium.org/svn/trunk/deps/third_party/cygwin@66844", |
|||
|
|||
"v8/third_party/python_26": |
|||
"http://src.chromium.org/svn/trunk/tools/third_party/python_26@89111", |
|||
} |
|||
} |
|||
|
|||
hooks = [ |
|||
{ |
|||
# A change to a .gyp, .gypi, or to GYP itself should run the generator. |
|||
"pattern": ".", |
|||
"action": ["python", "v8/build/gyp_v8"], |
|||
}, |
|||
] |
@ -1,134 +0,0 @@ |
|||
// Copyright 2012 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.
|
|||
|
|||
#include "elements-kind.h" |
|||
|
|||
#include "api.h" |
|||
#include "elements.h" |
|||
#include "objects.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
|
|||
void PrintElementsKind(FILE* out, ElementsKind kind) { |
|||
ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); |
|||
PrintF(out, "%s", accessor->name()); |
|||
} |
|||
|
|||
|
|||
ElementsKind GetInitialFastElementsKind() { |
|||
if (FLAG_packed_arrays) { |
|||
return FAST_SMI_ELEMENTS; |
|||
} else { |
|||
return FAST_HOLEY_SMI_ELEMENTS; |
|||
} |
|||
} |
|||
|
|||
|
|||
struct InitializeFastElementsKindSequence { |
|||
static void Construct( |
|||
ElementsKind** fast_elements_kind_sequence_ptr) { |
|||
ElementsKind* fast_elements_kind_sequence = |
|||
new ElementsKind[kFastElementsKindCount]; |
|||
*fast_elements_kind_sequence_ptr = fast_elements_kind_sequence; |
|||
STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND); |
|||
fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS; |
|||
fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS; |
|||
fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS; |
|||
fast_elements_kind_sequence[3] = FAST_HOLEY_DOUBLE_ELEMENTS; |
|||
fast_elements_kind_sequence[4] = FAST_ELEMENTS; |
|||
fast_elements_kind_sequence[5] = FAST_HOLEY_ELEMENTS; |
|||
} |
|||
}; |
|||
|
|||
|
|||
static LazyInstance<ElementsKind*, |
|||
InitializeFastElementsKindSequence>::type |
|||
fast_elements_kind_sequence = LAZY_INSTANCE_INITIALIZER; |
|||
|
|||
|
|||
ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number) { |
|||
ASSERT(sequence_number >= 0 && |
|||
sequence_number < kFastElementsKindCount); |
|||
return fast_elements_kind_sequence.Get()[sequence_number]; |
|||
} |
|||
|
|||
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind) { |
|||
for (int i = 0; i < kFastElementsKindCount; ++i) { |
|||
if (fast_elements_kind_sequence.Get()[i] == elements_kind) { |
|||
return i; |
|||
} |
|||
} |
|||
UNREACHABLE(); |
|||
return 0; |
|||
} |
|||
|
|||
|
|||
ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, |
|||
bool allow_only_packed) { |
|||
ASSERT(IsFastElementsKind(elements_kind)); |
|||
ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); |
|||
while (true) { |
|||
int index = |
|||
GetSequenceIndexFromFastElementsKind(elements_kind) + 1; |
|||
elements_kind = GetFastElementsKindFromSequenceIndex(index); |
|||
if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { |
|||
return elements_kind; |
|||
} |
|||
} |
|||
UNREACHABLE(); |
|||
return TERMINAL_FAST_ELEMENTS_KIND; |
|||
} |
|||
|
|||
|
|||
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
|||
ElementsKind to_kind) { |
|||
switch (from_kind) { |
|||
case FAST_SMI_ELEMENTS: |
|||
return to_kind != FAST_SMI_ELEMENTS; |
|||
case FAST_HOLEY_SMI_ELEMENTS: |
|||
return to_kind != FAST_SMI_ELEMENTS && |
|||
to_kind != FAST_HOLEY_SMI_ELEMENTS; |
|||
case FAST_DOUBLE_ELEMENTS: |
|||
return to_kind != FAST_SMI_ELEMENTS && |
|||
to_kind != FAST_HOLEY_SMI_ELEMENTS && |
|||
to_kind != FAST_DOUBLE_ELEMENTS; |
|||
case FAST_HOLEY_DOUBLE_ELEMENTS: |
|||
return to_kind == FAST_ELEMENTS || |
|||
to_kind == FAST_HOLEY_ELEMENTS; |
|||
case FAST_ELEMENTS: |
|||
return to_kind == FAST_HOLEY_ELEMENTS; |
|||
case FAST_HOLEY_ELEMENTS: |
|||
return false; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
} } // namespace v8::internal
|
@ -1,210 +0,0 @@ |
|||
// Copyright 2012 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.
|
|||
|
|||
#ifndef V8_ELEMENTS_KIND_H_ |
|||
#define V8_ELEMENTS_KIND_H_ |
|||
|
|||
#include "v8checks.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
enum ElementsKind { |
|||
// The "fast" kind for elements that only contain SMI values. Must be first
|
|||
// to make it possible to efficiently check maps for this kind.
|
|||
FAST_SMI_ELEMENTS, |
|||
FAST_HOLEY_SMI_ELEMENTS, |
|||
|
|||
// The "fast" kind for tagged values. Must be second to make it possible to
|
|||
// efficiently check maps for this and the FAST_SMI_ONLY_ELEMENTS kind
|
|||
// together at once.
|
|||
FAST_ELEMENTS, |
|||
FAST_HOLEY_ELEMENTS, |
|||
|
|||
// The "fast" kind for unwrapped, non-tagged double values.
|
|||
FAST_DOUBLE_ELEMENTS, |
|||
FAST_HOLEY_DOUBLE_ELEMENTS, |
|||
|
|||
// The "slow" kind.
|
|||
DICTIONARY_ELEMENTS, |
|||
NON_STRICT_ARGUMENTS_ELEMENTS, |
|||
// The "fast" kind for external arrays
|
|||
EXTERNAL_BYTE_ELEMENTS, |
|||
EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
|||
EXTERNAL_SHORT_ELEMENTS, |
|||
EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
|||
EXTERNAL_INT_ELEMENTS, |
|||
EXTERNAL_UNSIGNED_INT_ELEMENTS, |
|||
EXTERNAL_FLOAT_ELEMENTS, |
|||
EXTERNAL_DOUBLE_ELEMENTS, |
|||
EXTERNAL_PIXEL_ELEMENTS, |
|||
|
|||
// Derived constants from ElementsKind
|
|||
FIRST_ELEMENTS_KIND = FAST_SMI_ELEMENTS, |
|||
LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, |
|||
FIRST_FAST_ELEMENTS_KIND = FAST_SMI_ELEMENTS, |
|||
LAST_FAST_ELEMENTS_KIND = FAST_HOLEY_DOUBLE_ELEMENTS, |
|||
FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS, |
|||
LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, |
|||
TERMINAL_FAST_ELEMENTS_KIND = FAST_HOLEY_ELEMENTS |
|||
}; |
|||
|
|||
const int kElementsKindCount = LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1; |
|||
const int kFastElementsKindCount = LAST_FAST_ELEMENTS_KIND - |
|||
FIRST_FAST_ELEMENTS_KIND + 1; |
|||
|
|||
void PrintElementsKind(FILE* out, ElementsKind kind); |
|||
|
|||
ElementsKind GetInitialFastElementsKind(); |
|||
|
|||
ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_index); |
|||
|
|||
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind); |
|||
|
|||
|
|||
inline bool IsFastElementsKind(ElementsKind kind) { |
|||
ASSERT(FIRST_FAST_ELEMENTS_KIND == 0); |
|||
return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastDoubleElementsKind(ElementsKind kind) { |
|||
return kind == FAST_DOUBLE_ELEMENTS || |
|||
kind == FAST_HOLEY_DOUBLE_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastSmiOrObjectElementsKind(ElementsKind kind) { |
|||
return kind == FAST_SMI_ELEMENTS || |
|||
kind == FAST_HOLEY_SMI_ELEMENTS || |
|||
kind == FAST_ELEMENTS || |
|||
kind == FAST_HOLEY_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastSmiElementsKind(ElementsKind kind) { |
|||
return kind == FAST_SMI_ELEMENTS || |
|||
kind == FAST_HOLEY_SMI_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastObjectElementsKind(ElementsKind kind) { |
|||
return kind == FAST_ELEMENTS || |
|||
kind == FAST_HOLEY_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastHoleyElementsKind(ElementsKind kind) { |
|||
return kind == FAST_HOLEY_SMI_ELEMENTS || |
|||
kind == FAST_HOLEY_DOUBLE_ELEMENTS || |
|||
kind == FAST_HOLEY_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsHoleyElementsKind(ElementsKind kind) { |
|||
return IsFastHoleyElementsKind(kind) || |
|||
kind == DICTIONARY_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsFastPackedElementsKind(ElementsKind kind) { |
|||
return kind == FAST_SMI_ELEMENTS || |
|||
kind == FAST_DOUBLE_ELEMENTS || |
|||
kind == FAST_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline ElementsKind GetPackedElementsKind(ElementsKind holey_kind) { |
|||
if (holey_kind == FAST_HOLEY_SMI_ELEMENTS) { |
|||
return FAST_SMI_ELEMENTS; |
|||
} |
|||
if (holey_kind == FAST_HOLEY_DOUBLE_ELEMENTS) { |
|||
return FAST_DOUBLE_ELEMENTS; |
|||
} |
|||
if (holey_kind == FAST_HOLEY_ELEMENTS) { |
|||
return FAST_ELEMENTS; |
|||
} |
|||
return holey_kind; |
|||
} |
|||
|
|||
|
|||
inline ElementsKind GetHoleyElementsKind(ElementsKind packed_kind) { |
|||
if (packed_kind == FAST_SMI_ELEMENTS) { |
|||
return FAST_HOLEY_SMI_ELEMENTS; |
|||
} |
|||
if (packed_kind == FAST_DOUBLE_ELEMENTS) { |
|||
return FAST_HOLEY_DOUBLE_ELEMENTS; |
|||
} |
|||
if (packed_kind == FAST_ELEMENTS) { |
|||
return FAST_HOLEY_ELEMENTS; |
|||
} |
|||
return packed_kind; |
|||
} |
|||
|
|||
|
|||
inline ElementsKind FastSmiToObjectElementsKind(ElementsKind from_kind) { |
|||
ASSERT(IsFastSmiElementsKind(from_kind)); |
|||
return (from_kind == FAST_SMI_ELEMENTS) |
|||
? FAST_ELEMENTS |
|||
: FAST_HOLEY_ELEMENTS; |
|||
} |
|||
|
|||
|
|||
inline bool IsSimpleMapChangeTransition(ElementsKind from_kind, |
|||
ElementsKind to_kind) { |
|||
return (GetHoleyElementsKind(from_kind) == to_kind) || |
|||
(IsFastSmiElementsKind(from_kind) && |
|||
IsFastObjectElementsKind(to_kind)); |
|||
} |
|||
|
|||
|
|||
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
|||
ElementsKind to_kind); |
|||
|
|||
|
|||
inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) { |
|||
return IsFastElementsKind(from_kind) && |
|||
from_kind != TERMINAL_FAST_ELEMENTS_KIND; |
|||
} |
|||
|
|||
|
|||
ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, |
|||
bool allow_only_packed); |
|||
|
|||
|
|||
inline bool CanTransitionToMoreGeneralFastElementsKind( |
|||
ElementsKind elements_kind, |
|||
bool allow_only_packed) { |
|||
return IsFastElementsKind(elements_kind) && |
|||
(elements_kind != TERMINAL_FAST_ELEMENTS_KIND && |
|||
(!allow_only_packed || elements_kind != FAST_ELEMENTS)); |
|||
} |
|||
|
|||
|
|||
} } // namespace v8::internal
|
|||
|
|||
#endif // V8_ELEMENTS_KIND_H_
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue