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 4040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4051 } | 4051 } |
4052 Handle<String> key = GetString(); | 4052 Handle<String> key = GetString(); |
4053 if (scanner_.Next() != Token::COLON) { | 4053 if (scanner_.Next() != Token::COLON) { |
4054 return ReportUnexpectedToken(); | 4054 return ReportUnexpectedToken(); |
4055 } | 4055 } |
4056 Handle<Object> value = ParseJsonValue(); | 4056 Handle<Object> value = ParseJsonValue(); |
4057 if (value.is_null()) return Handle<Object>::null(); | 4057 if (value.is_null()) return Handle<Object>::null(); |
4058 uint32_t index; | 4058 uint32_t index; |
4059 if (key->AsArrayIndex(&index)) { | 4059 if (key->AsArrayIndex(&index)) { |
4060 SetOwnElement(json_object, index, value); | 4060 SetOwnElement(json_object, index, value); |
| 4061 } else if (key->Equals(Heap::Proto_symbol())) { |
| 4062 // We can't remove the __proto__ accessor since it's hardcoded |
| 4063 // in several places. Instead go along and add the value as |
| 4064 // the prototype of the created object if possible. |
| 4065 SetPrototype(json_object, value); |
4061 } else { | 4066 } else { |
4062 SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE); | 4067 SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE); |
4063 } | 4068 } |
4064 } while (scanner_.Next() == Token::COMMA); | 4069 } while (scanner_.Next() == Token::COMMA); |
4065 if (scanner_.current_token() != Token::RBRACE) { | 4070 if (scanner_.current_token() != Token::RBRACE) { |
4066 return ReportUnexpectedToken(); | 4071 return ReportUnexpectedToken(); |
4067 } | 4072 } |
4068 } | 4073 } |
4069 return json_object; | 4074 return json_object; |
4070 } | 4075 } |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5094 info->is_global(), | 5099 info->is_global(), |
5095 info->StrictMode()); | 5100 info->StrictMode()); |
5096 } | 5101 } |
5097 } | 5102 } |
5098 | 5103 |
5099 info->SetFunction(result); | 5104 info->SetFunction(result); |
5100 return (result != NULL); | 5105 return (result != NULL); |
5101 } | 5106 } |
5102 | 5107 |
5103 } } // namespace v8::internal | 5108 } } // namespace v8::internal |
OLD | NEW |