| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/ast/ast.h" | 5 #include "src/ast/ast.h" | 
| 6 | 6 | 
| 7 #include <cmath>  // For isfinite. | 7 #include <cmath>  // For isfinite. | 
| 8 | 8 | 
| 9 #include "src/ast/compile-time-value.h" | 9 #include "src/ast/compile-time-value.h" | 
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" | 
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 638 | 638 | 
| 639   Handle<FixedArrayBase> elements = fixed_array; | 639   Handle<FixedArrayBase> elements = fixed_array; | 
| 640   if (IsFastDoubleElementsKind(kind)) { | 640   if (IsFastDoubleElementsKind(kind)) { | 
| 641     ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 641     ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 
| 642     elements = isolate->factory()->NewFixedDoubleArray(constants_length); | 642     elements = isolate->factory()->NewFixedDoubleArray(constants_length); | 
| 643     // We are copying from non-fast-double to fast-double. | 643     // We are copying from non-fast-double to fast-double. | 
| 644     ElementsKind from_kind = TERMINAL_FAST_ELEMENTS_KIND; | 644     ElementsKind from_kind = TERMINAL_FAST_ELEMENTS_KIND; | 
| 645     accessor->CopyElements(fixed_array, from_kind, elements, constants_length); | 645     accessor->CopyElements(fixed_array, from_kind, elements, constants_length); | 
| 646   } | 646   } | 
| 647 | 647 | 
| 648   // Remember both the literal's constant values as well as the ElementsKind | 648   // Remember both the literal's constant values as well as the ElementsKind. | 
| 649   // in a 2-element FixedArray. | 649   Handle<ConstantElementsPair> literals = | 
| 650   Handle<FixedArray> literals = isolate->factory()->NewFixedArray(2, TENURED); | 650       isolate->factory()->NewConstantElementsPair(kind, elements); | 
| 651   literals->set(0, Smi::FromInt(kind)); |  | 
| 652   literals->set(1, *elements); |  | 
| 653 | 651 | 
| 654   constant_elements_ = literals; | 652   constant_elements_ = literals; | 
| 655   set_is_simple(is_simple); | 653   set_is_simple(is_simple); | 
| 656   set_depth(depth_acc); | 654   set_depth(depth_acc); | 
| 657 } | 655 } | 
| 658 | 656 | 
| 659 bool ArrayLiteral::IsFastCloningSupported() const { | 657 bool ArrayLiteral::IsFastCloningSupported() const { | 
| 660   return depth() <= 1 && | 658   return depth() <= 1 && | 
| 661          values()->length() <= | 659          values()->length() <= | 
| 662              FastCloneShallowArrayStub::kMaximumClonedElements; | 660              FastCloneShallowArrayStub::kMaximumClonedElements; | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 960 // static | 958 // static | 
| 961 bool Literal::Match(void* literal1, void* literal2) { | 959 bool Literal::Match(void* literal1, void* literal2) { | 
| 962   const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 960   const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 
| 963   const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 961   const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 
| 964   return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 962   return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 
| 965          (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 963          (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 
| 966 } | 964 } | 
| 967 | 965 | 
| 968 }  // namespace internal | 966 }  // namespace internal | 
| 969 }  // namespace v8 | 967 }  // namespace v8 | 
| OLD | NEW | 
|---|