OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 fun->shared()->set_is_toplevel(is_toplevel); | 230 fun->shared()->set_is_toplevel(is_toplevel); |
231 } | 231 } |
232 | 232 |
233 | 233 |
234 static Handle<Code> ComputeLazyCompile(int argc) { | 234 static Handle<Code> ComputeLazyCompile(int argc) { |
235 CALL_HEAP_FUNCTION(StubCache::ComputeLazyCompile(argc), Code); | 235 CALL_HEAP_FUNCTION(StubCache::ComputeLazyCompile(argc), Code); |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) { | 239 Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) { |
| 240 #ifdef DEBUG |
| 241 // We should not try to compile the same function literal more than |
| 242 // once. |
| 243 ASSERT(!node->already_compiled()); |
| 244 node->mark_as_compiled(); |
| 245 #endif |
| 246 |
240 // Determine if the function can be lazily compiled. This is | 247 // Determine if the function can be lazily compiled. This is |
241 // necessary to allow some of our builtin JS files to be lazily | 248 // necessary to allow some of our builtin JS files to be lazily |
242 // compiled. These builtins cannot be handled lazily by the parser, | 249 // compiled. These builtins cannot be handled lazily by the parser, |
243 // since we have to know if a function uses the special natives | 250 // since we have to know if a function uses the special natives |
244 // syntax, which is something the parser records. | 251 // syntax, which is something the parser records. |
245 bool allow_lazy = node->AllowsLazyCompilation(); | 252 bool allow_lazy = node->AllowsLazyCompilation(); |
246 | 253 |
247 // Generate code | 254 // Generate code |
248 Handle<Code> code; | 255 Handle<Code> code; |
249 if (FLAG_lazy && allow_lazy) { | 256 if (FLAG_lazy && allow_lazy) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 578 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
572 switch (type_) { | 579 switch (type_) { |
573 case READ_LENGTH: GenerateReadLength(masm); break; | 580 case READ_LENGTH: GenerateReadLength(masm); break; |
574 case READ_ELEMENT: GenerateReadElement(masm); break; | 581 case READ_ELEMENT: GenerateReadElement(masm); break; |
575 case NEW_OBJECT: GenerateNewObject(masm); break; | 582 case NEW_OBJECT: GenerateNewObject(masm); break; |
576 } | 583 } |
577 } | 584 } |
578 | 585 |
579 | 586 |
580 } } // namespace v8::internal | 587 } } // namespace v8::internal |
OLD | NEW |