| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // The start_position points to the first '(' character after the function name | 223 // The start_position points to the first '(' character after the function name |
| 224 // in the full script source. When counting characters in the script source the | 224 // in the full script source. When counting characters in the script source the |
| 225 // the first character is number 0 (not 1). | 225 // the first character is number 0 (not 1). |
| 226 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, | 226 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, |
| 227 int length, | 227 int length, |
| 228 int function_token_position, | 228 int function_token_position, |
| 229 int start_position, | 229 int start_position, |
| 230 int end_position, | 230 int end_position, |
| 231 bool is_expression, | 231 bool is_expression, |
| 232 bool is_toplevel, | 232 bool is_toplevel, |
| 233 Handle<Script> script) { | 233 Handle<Script> script, |
| 234 Handle<String> inferred_name) { |
| 234 fun->shared()->set_length(length); | 235 fun->shared()->set_length(length); |
| 235 fun->shared()->set_formal_parameter_count(length); | 236 fun->shared()->set_formal_parameter_count(length); |
| 236 fun->shared()->set_script(*script); | 237 fun->shared()->set_script(*script); |
| 237 fun->shared()->set_function_token_position(function_token_position); | 238 fun->shared()->set_function_token_position(function_token_position); |
| 238 fun->shared()->set_start_position(start_position); | 239 fun->shared()->set_start_position(start_position); |
| 239 fun->shared()->set_end_position(end_position); | 240 fun->shared()->set_end_position(end_position); |
| 240 fun->shared()->set_is_expression(is_expression); | 241 fun->shared()->set_is_expression(is_expression); |
| 241 fun->shared()->set_is_toplevel(is_toplevel); | 242 fun->shared()->set_is_toplevel(is_toplevel); |
| 243 fun->shared()->set_inferred_name(*inferred_name); |
| 242 } | 244 } |
| 243 | 245 |
| 244 | 246 |
| 245 static Handle<Code> ComputeLazyCompile(int argc) { | 247 static Handle<Code> ComputeLazyCompile(int argc) { |
| 246 CALL_HEAP_FUNCTION(StubCache::ComputeLazyCompile(argc), Code); | 248 CALL_HEAP_FUNCTION(StubCache::ComputeLazyCompile(argc), Code); |
| 247 } | 249 } |
| 248 | 250 |
| 249 | 251 |
| 250 Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) { | 252 Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) { |
| 251 #ifdef DEBUG | 253 #ifdef DEBUG |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 294 |
| 293 // Create a boilerplate function. | 295 // Create a boilerplate function. |
| 294 Handle<JSFunction> function = | 296 Handle<JSFunction> function = |
| 295 Factory::NewFunctionBoilerplate(node->name(), | 297 Factory::NewFunctionBoilerplate(node->name(), |
| 296 node->materialized_literal_count(), | 298 node->materialized_literal_count(), |
| 297 node->contains_array_literal(), | 299 node->contains_array_literal(), |
| 298 code); | 300 code); |
| 299 CodeGenerator::SetFunctionInfo(function, node->num_parameters(), | 301 CodeGenerator::SetFunctionInfo(function, node->num_parameters(), |
| 300 node->function_token_position(), | 302 node->function_token_position(), |
| 301 node->start_position(), node->end_position(), | 303 node->start_position(), node->end_position(), |
| 302 node->is_expression(), false, script_); | 304 node->is_expression(), false, script_, |
| 305 node->inferred_name()); |
| 303 | 306 |
| 304 // Notify debugger that a new function has been added. | 307 // Notify debugger that a new function has been added. |
| 305 Debugger::OnNewFunction(function); | 308 Debugger::OnNewFunction(function); |
| 306 | 309 |
| 307 // Set the expected number of properties for instances and return | 310 // Set the expected number of properties for instances and return |
| 308 // the resulting function. | 311 // the resulting function. |
| 309 SetExpectedNofPropertiesFromEstimate(function, | 312 SetExpectedNofPropertiesFromEstimate(function, |
| 310 node->expected_property_count()); | 313 node->expected_property_count()); |
| 311 return function; | 314 return function; |
| 312 } | 315 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 613 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
| 611 switch (type_) { | 614 switch (type_) { |
| 612 case READ_LENGTH: GenerateReadLength(masm); break; | 615 case READ_LENGTH: GenerateReadLength(masm); break; |
| 613 case READ_ELEMENT: GenerateReadElement(masm); break; | 616 case READ_ELEMENT: GenerateReadElement(masm); break; |
| 614 case NEW_OBJECT: GenerateNewObject(masm); break; | 617 case NEW_OBJECT: GenerateNewObject(masm); break; |
| 615 } | 618 } |
| 616 } | 619 } |
| 617 | 620 |
| 618 | 621 |
| 619 } } // namespace v8::internal | 622 } } // namespace v8::internal |
| OLD | NEW |