Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: src/codegen.cc

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/codegen.h ('k') | src/compiler.cc » ('j') | src/runtime.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 } 331 }
332 } 332 }
333 333
334 // Invoke the platform-dependent code generator to do the actual 334 // Invoke the platform-dependent code generator to do the actual
335 // declaration the global variables and functions. 335 // declaration the global variables and functions.
336 DeclareGlobals(array); 336 DeclareGlobals(array);
337 } 337 }
338 338
339 339
340 // List of special runtime calls which are generated inline. For some of these 340 InlineRuntimeFunctionsTable::Entry* CodeGenerator::FindInlineRuntimeLUT(
341 // functions the code will be generated inline, and for others a call to a code
342 // stub will be inlined.
343
344 #define INLINE_RUNTIME_ENTRY(Name, argc, ressize) \
345 {&CodeGenerator::Generate##Name, "_" #Name, argc}, \
346
347 CodeGenerator::InlineRuntimeLUT CodeGenerator::kInlineRuntimeLUT[] = {
348 INLINE_RUNTIME_FUNCTION_LIST(INLINE_RUNTIME_ENTRY)
349 };
350
351 #undef INLINE_RUNTIME_ENTRY
352
353 CodeGenerator::InlineRuntimeLUT* CodeGenerator::FindInlineRuntimeLUT(
354 Handle<String> name) { 341 Handle<String> name) {
355 const int entries_count = 342 Isolate* isolate = Isolate::Current();
356 sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT); 343 InlineRuntimeFunctionsTable::Entry* entries =
357 for (int i = 0; i < entries_count; i++) { 344 isolate->inline_runtime_functions_table()->entries();
358 InlineRuntimeLUT* entry = &kInlineRuntimeLUT[i]; 345 for (int i = 0;
346 i < InlineRuntimeFunctionsTable::kInlineRuntimeFunctionsTableSize;
347 ++i) {
348 InlineRuntimeFunctionsTable::Entry* entry = &entries[i];
359 if (name->IsEqualTo(CStrVector(entry->name))) { 349 if (name->IsEqualTo(CStrVector(entry->name))) {
360 return entry; 350 return entry;
361 } 351 }
362 } 352 }
363 return NULL; 353 return NULL;
364 } 354 }
365 355
366 356
367 bool CodeGenerator::CheckForInlineRuntimeCall(CallRuntime* node) { 357 bool CodeGenerator::CheckForInlineRuntimeCall(CallRuntime* node) {
368 ZoneList<Expression*>* args = node->arguments(); 358 ZoneList<Expression*>* args = node->arguments();
369 Handle<String> name = node->name(); 359 Handle<String> name = node->name();
370 if (name->length() > 0 && name->Get(0) == '_') { 360 if (name->length() > 0 && name->Get(0) == '_') {
371 InlineRuntimeLUT* entry = FindInlineRuntimeLUT(name); 361 InlineRuntimeFunctionsTable::Entry* entry = FindInlineRuntimeLUT(name);
372 if (entry != NULL) { 362 if (entry != NULL) {
373 ((*this).*(entry->method))(args); 363 ((*this).*(entry->method))(args);
374 return true; 364 return true;
375 } 365 }
376 } 366 }
377 return false; 367 return false;
378 } 368 }
379 369
380 370
381 bool CodeGenerator::PatchInlineRuntimeEntry(Handle<String> name, 371 bool CodeGenerator::PatchInlineRuntimeEntry(Handle<String> name,
382 const CodeGenerator::InlineRuntimeLUT& new_entry, 372 const InlineRuntimeFunctionsTable::Entry& new_entry,
383 CodeGenerator::InlineRuntimeLUT* old_entry) { 373 InlineRuntimeFunctionsTable::Entry* old_entry) {
384 InlineRuntimeLUT* entry = FindInlineRuntimeLUT(name); 374 InlineRuntimeFunctionsTable::Entry* entry = FindInlineRuntimeLUT(name);
385 if (entry == NULL) return false; 375 if (entry == NULL) return false;
386 if (old_entry != NULL) { 376 if (old_entry != NULL) {
387 old_entry->name = entry->name; 377 old_entry->name = entry->name;
388 old_entry->method = entry->method; 378 old_entry->method = entry->method;
389 } 379 }
390 entry->name = new_entry.name; 380 entry->name = new_entry.name;
391 entry->method = new_entry.method; 381 entry->method = new_entry.method;
392 return true; 382 return true;
393 } 383 }
394 384
395 385
396 int CodeGenerator::InlineRuntimeCallArgumentsCount(Handle<String> name) { 386 int CodeGenerator::InlineRuntimeCallArgumentsCount(Handle<String> name) {
397 CodeGenerator::InlineRuntimeLUT* f = 387 InlineRuntimeFunctionsTable::Entry* f =
398 CodeGenerator::FindInlineRuntimeLUT(name); 388 CodeGenerator::FindInlineRuntimeLUT(name);
399 if (f != NULL) return f->nargs; 389 if (f != NULL) return f->nargs;
400 return -1; 390 return -1;
401 } 391 }
402 392
403 393
404 // Simple condition analysis. ALWAYS_TRUE and ALWAYS_FALSE represent a 394 // Simple condition analysis. ALWAYS_TRUE and ALWAYS_FALSE represent a
405 // known result for the test expression, with no side effects. 395 // known result for the test expression, with no side effects.
406 CodeGenerator::ConditionAnalysis CodeGenerator::AnalyzeCondition( 396 CodeGenerator::ConditionAnalysis CodeGenerator::AnalyzeCondition(
407 Expression* cond) { 397 Expression* cond) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 498 }
509 } 499 }
510 500
511 501
512 void ApiGetterEntryStub::SetCustomCache(Code* value) { 502 void ApiGetterEntryStub::SetCustomCache(Code* value) {
513 info()->set_load_stub_cache(value); 503 info()->set_load_stub_cache(value);
514 } 504 }
515 505
516 506
517 } } // namespace v8::internal 507 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.h ('k') | src/compiler.cc » ('j') | src/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698