OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 for (int i = 0; i < code_.length(); i++) { | 242 for (int i = 0; i < code_.length(); i++) { |
243 const char* name = name_[i]; | 243 const char* name = name_[i]; |
244 uint32_t flags = flags_[i]; | 244 uint32_t flags = flags_[i]; |
245 Handle<String> symbol = Factory::LookupAsciiSymbol(name); | 245 Handle<String> symbol = Factory::LookupAsciiSymbol(name); |
246 Object* o = builtins->GetProperty(*symbol); | 246 Object* o = builtins->GetProperty(*symbol); |
247 #ifdef DEBUG | 247 #ifdef DEBUG |
248 if (!o->IsJSFunction()) { | 248 if (!o->IsJSFunction()) { |
249 V8_Fatal(__FILE__, __LINE__, "Cannot resolve call to builtin %s", name); | 249 V8_Fatal(__FILE__, __LINE__, "Cannot resolve call to builtin %s", name); |
250 } | 250 } |
251 #endif | 251 #endif |
252 Handle<JSFunction> f = Handle<JSFunction>(JSFunction::cast(o)); | 252 Handle<SharedFunctionInfo> shared(JSFunction::cast(o)->shared()); |
253 // Make sure the number of parameters match the formal parameter count. | 253 // Make sure the number of parameters match the formal parameter count. |
254 int argc = Bootstrapper::FixupFlagsArgumentsCount::decode(flags); | 254 int argc = Bootstrapper::FixupFlagsArgumentsCount::decode(flags); |
255 USE(argc); | 255 USE(argc); |
256 ASSERT(f->shared()->formal_parameter_count() == argc); | 256 ASSERT(shared->formal_parameter_count() == argc); |
257 if (!f->is_compiled()) { | 257 // Do lazy compilation if necessary and check for stack overflows. |
258 // Do lazy compilation and check for stack overflows. | 258 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) { |
259 if (!CompileLazy(f, CLEAR_EXCEPTION)) { | 259 Clear(); |
260 Clear(); | 260 return false; |
261 return false; | |
262 } | |
263 } | 261 } |
264 Code* code = Code::cast(code_[i]); | 262 Code* code = Code::cast(code_[i]); |
265 Address pc = code->instruction_start() + pc_[i]; | 263 Address pc = code->instruction_start() + pc_[i]; |
266 RelocInfo target(pc, RelocInfo::CODE_TARGET, 0); | 264 RelocInfo target(pc, RelocInfo::CODE_TARGET, 0); |
267 bool use_code_object = Bootstrapper::FixupFlagsUseCodeObject::decode(flags); | 265 bool use_code_object = Bootstrapper::FixupFlagsUseCodeObject::decode(flags); |
268 if (use_code_object) { | 266 if (use_code_object) { |
269 target.set_target_object(f->code()); | 267 target.set_target_object(shared->code()); |
270 } else { | 268 } else { |
271 target.set_target_address(f->code()->instruction_start()); | 269 target.set_target_address(shared->code()->instruction_start()); |
272 } | 270 } |
273 LOG(StringEvent("resolved", name)); | 271 LOG(StringEvent("resolved", name)); |
274 } | 272 } |
275 Clear(); | 273 Clear(); |
276 | 274 |
277 // TODO(1240818): We should probably try to avoid doing this for all | 275 // TODO(1240818): We should probably try to avoid doing this for all |
278 // the V8 builtin JS files. It should only happen after running | 276 // the V8 builtin JS files. It should only happen after running |
279 // runtime.js - just like there shouldn't be any fixups left after | 277 // runtime.js - just like there shouldn't be any fixups left after |
280 // that. | 278 // that. |
281 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { | 279 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 } | 1669 } |
1672 | 1670 |
1673 | 1671 |
1674 // Restore statics that are thread local. | 1672 // Restore statics that are thread local. |
1675 char* Genesis::RestoreState(char* from) { | 1673 char* Genesis::RestoreState(char* from) { |
1676 current_ = *reinterpret_cast<Genesis**>(from); | 1674 current_ = *reinterpret_cast<Genesis**>(from); |
1677 return from + sizeof(current_); | 1675 return from + sizeof(current_); |
1678 } | 1676 } |
1679 | 1677 |
1680 } } // namespace v8::internal | 1678 } } // namespace v8::internal |
OLD | NEW |