| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 return expression->AsLiteral()->handle(); | 3028 return expression->AsLiteral()->handle(); |
| 3029 } | 3029 } |
| 3030 if (CompileTimeValue::IsCompileTimeValue(expression)) { | 3030 if (CompileTimeValue::IsCompileTimeValue(expression)) { |
| 3031 return CompileTimeValue::GetValue(expression); | 3031 return CompileTimeValue::GetValue(expression); |
| 3032 } | 3032 } |
| 3033 return Factory::undefined_value(); | 3033 return Factory::undefined_value(); |
| 3034 } | 3034 } |
| 3035 | 3035 |
| 3036 // Defined in ast.cc | 3036 // Defined in ast.cc |
| 3037 bool IsEqualString(void* first, void* second); | 3037 bool IsEqualString(void* first, void* second); |
| 3038 bool IsEqualSmi(void* first, void* second); | 3038 bool IsEqualNumber(void* first, void* second); |
| 3039 | 3039 |
| 3040 | 3040 |
| 3041 // Validation per 11.1.5 Object Initialiser | 3041 // Validation per 11.1.5 Object Initialiser |
| 3042 class ObjectLiteralPropertyChecker { | 3042 class ObjectLiteralPropertyChecker { |
| 3043 public: | 3043 public: |
| 3044 ObjectLiteralPropertyChecker(Parser* parser, bool strict) : | 3044 ObjectLiteralPropertyChecker(Parser* parser, bool strict) : |
| 3045 props(&IsEqualString), | 3045 props(&IsEqualString), |
| 3046 elems(&IsEqualSmi), | 3046 elems(&IsEqualNumber), |
| 3047 parser_(parser), | 3047 parser_(parser), |
| 3048 strict_(strict) { | 3048 strict_(strict) { |
| 3049 } | 3049 } |
| 3050 | 3050 |
| 3051 void CheckProperty( | 3051 void CheckProperty( |
| 3052 ObjectLiteral::Property* property, | 3052 ObjectLiteral::Property* property, |
| 3053 Scanner::Location loc, | 3053 Scanner::Location loc, |
| 3054 bool* ok); | 3054 bool* ok); |
| 3055 | 3055 |
| 3056 private: | 3056 private: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3085 bool* ok) { | 3085 bool* ok) { |
| 3086 | 3086 |
| 3087 ASSERT(property != NULL); | 3087 ASSERT(property != NULL); |
| 3088 | 3088 |
| 3089 Literal *lit = property->key(); | 3089 Literal *lit = property->key(); |
| 3090 Handle<Object> handle = lit->handle(); | 3090 Handle<Object> handle = lit->handle(); |
| 3091 | 3091 |
| 3092 uint32_t hash; | 3092 uint32_t hash; |
| 3093 HashMap* map; | 3093 HashMap* map; |
| 3094 void* key; | 3094 void* key; |
| 3095 Smi* smi_key_location; | |
| 3096 | 3095 |
| 3097 if (handle->IsSymbol()) { | 3096 if (handle->IsSymbol()) { |
| 3098 Handle<String> name(String::cast(*handle)); | 3097 Handle<String> name(String::cast(*handle)); |
| 3099 if (name->AsArrayIndex(&hash)) { | 3098 if (name->AsArrayIndex(&hash)) { |
| 3100 smi_key_location = Smi::FromInt(hash); | 3099 Handle<Object> key_handle = Factory::NewNumberFromUint(hash); |
| 3101 key = &smi_key_location; | 3100 key = key_handle.location(); |
| 3102 map = &elems; | 3101 map = &elems; |
| 3103 } else { | 3102 } else { |
| 3104 key = handle.location(); | 3103 key = handle.location(); |
| 3105 hash = name->Hash(); | 3104 hash = name->Hash(); |
| 3106 map = &props; | 3105 map = &props; |
| 3107 } | 3106 } |
| 3108 } else if (handle->ToArrayIndex(&hash)) { | 3107 } else if (handle->ToArrayIndex(&hash)) { |
| 3109 key = handle.location(); | 3108 key = handle.location(); |
| 3110 map = &elems; | 3109 map = &elems; |
| 3111 } else { | 3110 } else { |
| (...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 Handle<String> source = Handle<String>(String::cast(script->source())); | 5026 Handle<String> source = Handle<String>(String::cast(script->source())); |
| 5028 result = parser.ParseProgram(source, info->is_global()); | 5027 result = parser.ParseProgram(source, info->is_global()); |
| 5029 } | 5028 } |
| 5030 } | 5029 } |
| 5031 | 5030 |
| 5032 info->SetFunction(result); | 5031 info->SetFunction(result); |
| 5033 return (result != NULL); | 5032 return (result != NULL); |
| 5034 } | 5033 } |
| 5035 | 5034 |
| 5036 } } // namespace v8::internal | 5035 } } // namespace v8::internal |
| OLD | NEW |