OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "ast.h" | 30 #include "ast.h" |
| 31 #include "parser.h" |
31 #include "scopes.h" | 32 #include "scopes.h" |
32 #include "string-stream.h" | 33 #include "string-stream.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 | 38 |
38 VariableProxySentinel VariableProxySentinel::this_proxy_(true); | 39 VariableProxySentinel VariableProxySentinel::this_proxy_(true); |
39 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); | 40 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); |
40 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; | 41 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 132 } |
132 | 133 |
133 | 134 |
134 ObjectLiteral::Property::Property(bool is_getter, FunctionLiteral* value) { | 135 ObjectLiteral::Property::Property(bool is_getter, FunctionLiteral* value) { |
135 key_ = new Literal(value->name()); | 136 key_ = new Literal(value->name()); |
136 value_ = value; | 137 value_ = value; |
137 kind_ = is_getter ? GETTER : SETTER; | 138 kind_ = is_getter ? GETTER : SETTER; |
138 } | 139 } |
139 | 140 |
140 | 141 |
| 142 bool ObjectLiteral::Property::IsCompileTimeValue() { |
| 143 return kind_ == CONSTANT || |
| 144 (kind_ == MATERIALIZED_LITERAL && |
| 145 CompileTimeValue::IsCompileTimeValue(value_)); |
| 146 } |
| 147 |
| 148 |
141 bool ObjectLiteral::IsValidJSON() { | 149 bool ObjectLiteral::IsValidJSON() { |
142 int length = properties()->length(); | 150 int length = properties()->length(); |
143 for (int i = 0; i < length; i++) { | 151 for (int i = 0; i < length; i++) { |
144 Property* prop = properties()->at(i); | 152 Property* prop = properties()->at(i); |
145 if (!prop->value()->IsValidJSON()) | 153 if (!prop->value()->IsValidJSON()) |
146 return false; | 154 return false; |
147 } | 155 } |
148 return true; | 156 return true; |
149 } | 157 } |
150 | 158 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if (kInfinity - max_match_ < node_max_match) { | 503 if (kInfinity - max_match_ < node_max_match) { |
496 max_match_ = kInfinity; | 504 max_match_ = kInfinity; |
497 } else { | 505 } else { |
498 max_match_ += node->max_match(); | 506 max_match_ += node->max_match(); |
499 } | 507 } |
500 } | 508 } |
501 } | 509 } |
502 | 510 |
503 | 511 |
504 } } // namespace v8::internal | 512 } } // namespace v8::internal |
OLD | NEW |