OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot)); | 3490 Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot)); |
3491 return static_cast<LiteralType>(literal_type->value()); | 3491 return static_cast<LiteralType>(literal_type->value()); |
3492 } | 3492 } |
3493 | 3493 |
3494 | 3494 |
3495 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) { | 3495 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) { |
3496 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot))); | 3496 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot))); |
3497 } | 3497 } |
3498 | 3498 |
3499 | 3499 |
3500 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { | |
3501 // Arguments :: | |
3502 // '(' (AssignmentExpression)*[','] ')' | |
3503 | |
3504 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4, zone()); | |
3505 Expect(Token::LPAREN, CHECK_OK); | |
3506 bool done = (peek() == Token::RPAREN); | |
3507 while (!done) { | |
3508 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); | |
3509 result->Add(argument, zone()); | |
3510 if (result->length() > Code::kMaxArguments) { | |
3511 ReportMessageAt(scanner()->location(), "too_many_arguments"); | |
3512 *ok = false; | |
3513 return NULL; | |
3514 } | |
3515 done = (peek() == Token::RPAREN); | |
3516 if (!done) Expect(Token::COMMA, CHECK_OK); | |
3517 } | |
3518 Expect(Token::RPAREN, CHECK_OK); | |
3519 return result; | |
3520 } | |
3521 | |
3522 | |
3523 class SingletonLogger : public ParserRecorder { | 3500 class SingletonLogger : public ParserRecorder { |
3524 public: | 3501 public: |
3525 SingletonLogger() : has_error_(false), start_(-1), end_(-1) { } | 3502 SingletonLogger() : has_error_(false), start_(-1), end_(-1) { } |
3526 virtual ~SingletonLogger() { } | 3503 virtual ~SingletonLogger() { } |
3527 | 3504 |
3528 void Reset() { has_error_ = false; } | 3505 void Reset() { has_error_ = false; } |
3529 | 3506 |
3530 virtual void LogFunction(int start, | 3507 virtual void LogFunction(int start, |
3531 int end, | 3508 int end, |
3532 int literals, | 3509 int literals, |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5193 ASSERT(info()->isolate()->has_pending_exception()); | 5170 ASSERT(info()->isolate()->has_pending_exception()); |
5194 } else { | 5171 } else { |
5195 result = ParseProgram(); | 5172 result = ParseProgram(); |
5196 } | 5173 } |
5197 } | 5174 } |
5198 info()->SetFunction(result); | 5175 info()->SetFunction(result); |
5199 return (result != NULL); | 5176 return (result != NULL); |
5200 } | 5177 } |
5201 | 5178 |
5202 } } // namespace v8::internal | 5179 } } // namespace v8::internal |
OLD | NEW |