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

Side by Side Diff: src/builtins.cc

Issue 6788007: Fix multi-isolate build: (Closed)
Patch Set: Created 9 years, 8 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
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) 1587 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C)
1588 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) 1588 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A)
1589 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) 1589 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A)
1590 1590
1591 #undef DEF_FUNCTION_PTR_C 1591 #undef DEF_FUNCTION_PTR_C
1592 #undef DEF_FUNCTION_PTR_A 1592 #undef DEF_FUNCTION_PTR_A
1593 } 1593 }
1594 1594
1595 void Builtins::Setup(bool create_heap_objects) { 1595 void Builtins::Setup(bool create_heap_objects) {
1596 ASSERT(!initialized_); 1596 ASSERT(!initialized_);
1597 Heap* heap = Isolate::Current()->heap(); 1597 Isolate* isolate = Isolate::Current();
1598 Heap* heap = isolate->heap();
1598 1599
1599 // Create a scope for the handles in the builtins. 1600 // Create a scope for the handles in the builtins.
1600 HandleScope scope; 1601 HandleScope scope(isolate);
1601 1602
1602 const BuiltinDesc* functions = BuiltinFunctionTable::functions(); 1603 const BuiltinDesc* functions = BuiltinFunctionTable::functions();
1603 1604
1604 // For now we generate builtin adaptor code into a stack-allocated 1605 // For now we generate builtin adaptor code into a stack-allocated
1605 // buffer, before copying it into individual code objects. 1606 // buffer, before copying it into individual code objects.
1606 byte buffer[4*KB]; 1607 byte buffer[4*KB];
1607 1608
1608 // Traverse the list of builtins and generate an adaptor in a 1609 // Traverse the list of builtins and generate an adaptor in a
1609 // separate code object for each one. 1610 // separate code object for each one.
1610 for (int i = 0; i < builtin_count; i++) { 1611 for (int i = 0; i < builtin_count; i++) {
1611 if (create_heap_objects) { 1612 if (create_heap_objects) {
1612 MacroAssembler masm(buffer, sizeof buffer); 1613 MacroAssembler masm(isolate, buffer, sizeof buffer);
1613 // Generate the code/adaptor. 1614 // Generate the code/adaptor.
1614 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); 1615 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments);
1615 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); 1616 Generator g = FUNCTION_CAST<Generator>(functions[i].generator);
1616 // We pass all arguments to the generator, but it may not use all of 1617 // We pass all arguments to the generator, but it may not use all of
1617 // them. This works because the first arguments are on top of the 1618 // them. This works because the first arguments are on top of the
1618 // stack. 1619 // stack.
1619 g(&masm, functions[i].name, functions[i].extra_args); 1620 g(&masm, functions[i].name, functions[i].extra_args);
1620 // Move the code into the object heap. 1621 // Move the code into the object heap.
1621 CodeDesc desc; 1622 CodeDesc desc;
1622 masm.GetCode(&desc); 1623 masm.GetCode(&desc);
1623 Code::Flags flags = functions[i].flags; 1624 Code::Flags flags = functions[i].flags;
1624 Object* code = NULL; 1625 Object* code = NULL;
1625 { 1626 {
1626 // During startup it's OK to always allocate and defer GC to later. 1627 // During startup it's OK to always allocate and defer GC to later.
1627 // This simplifies things because we don't need to retry. 1628 // This simplifies things because we don't need to retry.
1628 AlwaysAllocateScope __scope__; 1629 AlwaysAllocateScope __scope__;
1629 { MaybeObject* maybe_code = 1630 { MaybeObject* maybe_code =
1630 heap->CreateCode(desc, flags, masm.CodeObject()); 1631 heap->CreateCode(desc, flags, masm.CodeObject());
1631 if (!maybe_code->ToObject(&code)) { 1632 if (!maybe_code->ToObject(&code)) {
1632 v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); 1633 v8::internal::V8::FatalProcessOutOfMemory("CreateCode");
1633 } 1634 }
1634 } 1635 }
1635 } 1636 }
1636 // Log the event and add the code to the builtins array. 1637 // Log the event and add the code to the builtins array.
1637 PROFILE(ISOLATE, 1638 PROFILE(isolate,
1638 CodeCreateEvent(Logger::BUILTIN_TAG, 1639 CodeCreateEvent(Logger::BUILTIN_TAG,
1639 Code::cast(code), 1640 Code::cast(code),
1640 functions[i].s_name)); 1641 functions[i].s_name));
1641 GDBJIT(AddCode(GDBJITInterface::BUILTIN, 1642 GDBJIT(AddCode(GDBJITInterface::BUILTIN,
1642 functions[i].s_name, 1643 functions[i].s_name,
1643 Code::cast(code))); 1644 Code::cast(code)));
1644 builtins_[i] = code; 1645 builtins_[i] = code;
1645 #ifdef ENABLE_DISASSEMBLER 1646 #ifdef ENABLE_DISASSEMBLER
1646 if (FLAG_print_builtin_code) { 1647 if (FLAG_print_builtin_code) {
1647 PrintF("Builtin: %s\n", functions[i].s_name); 1648 PrintF("Builtin: %s\n", functions[i].s_name);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 return Handle<Code>(code_address); \ 1699 return Handle<Code>(code_address); \
1699 } 1700 }
1700 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1701 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1701 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1702 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1702 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1703 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1703 #undef DEFINE_BUILTIN_ACCESSOR_C 1704 #undef DEFINE_BUILTIN_ACCESSOR_C
1704 #undef DEFINE_BUILTIN_ACCESSOR_A 1705 #undef DEFINE_BUILTIN_ACCESSOR_A
1705 1706
1706 1707
1707 } } // namespace v8::internal 1708 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698