blob: 229b8df970f1b5b24653ee58b80072cdef6d4d1c [file] [log] [blame]
Steve Blocka7e24c12009-10-30 11:49:00 +00001// Copyright 2006-2008 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include <stdlib.h>
29
30#include "v8.h"
31
32#include "api.h"
33#include "codegen-inl.h"
34
35#if V8_TARGET_ARCH_IA32
36#include "ia32/simulator-ia32.h"
37#elif V8_TARGET_ARCH_X64
38#include "x64/simulator-x64.h"
39#elif V8_TARGET_ARCH_ARM
40#include "arm/simulator-arm.h"
41#else
42#error Unsupported target architecture.
43#endif
44
45#include "debug.h"
46#include "v8threads.h"
47
48namespace v8 {
49namespace internal {
50
51
52static Handle<Object> Invoke(bool construct,
53 Handle<JSFunction> func,
54 Handle<Object> receiver,
55 int argc,
56 Object*** args,
57 bool* has_pending_exception) {
58 // Make sure we have a real function, not a boilerplate function.
59 ASSERT(!func->IsBoilerplate());
60
61 // Entering JavaScript.
62 VMState state(JS);
63
64 // Placeholder for return value.
65 Object* value = reinterpret_cast<Object*>(kZapValue);
66
67 typedef Object* (*JSEntryFunction)(
68 byte* entry,
69 Object* function,
70 Object* receiver,
71 int argc,
72 Object*** args);
73
74 Handle<Code> code;
75 if (construct) {
76 JSConstructEntryStub stub;
77 code = stub.GetCode();
78 } else {
79 JSEntryStub stub;
80 code = stub.GetCode();
81 }
82
83 // Convert calls on global objects to be calls on the global
84 // receiver instead to avoid having a 'this' pointer which refers
85 // directly to a global object.
86 if (receiver->IsGlobalObject()) {
87 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
88 receiver = Handle<JSObject>(global->global_receiver());
89 }
90
91 {
92 // Save and restore context around invocation and block the
93 // allocation of handles without explicit handle scopes.
94 SaveContext save;
95 NoHandleAllocation na;
96 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry());
97
98 // Call the function through the right JS entry stub.
Steve Block3ce2e202009-11-05 08:53:23 +000099 byte* entry_address= func->code()->entry();
100 JSFunction* function = *func;
101 Object* receiver_pointer = *receiver;
102 value = CALL_GENERATED_CODE(entry, entry_address, function,
103 receiver_pointer, argc, args);
Steve Blocka7e24c12009-10-30 11:49:00 +0000104 }
105
106#ifdef DEBUG
107 value->Verify();
108#endif
109
110 // Update the pending exception flag and return the value.
111 *has_pending_exception = value->IsException();
112 ASSERT(*has_pending_exception == Top::has_pending_exception());
113 if (*has_pending_exception) {
114 Top::ReportPendingMessages();
115 return Handle<Object>();
116 } else {
117 Top::clear_pending_message();
118 }
119
120 return Handle<Object>(value);
121}
122
123
124Handle<Object> Execution::Call(Handle<JSFunction> func,
125 Handle<Object> receiver,
126 int argc,
127 Object*** args,
128 bool* pending_exception) {
129 return Invoke(false, func, receiver, argc, args, pending_exception);
130}
131
132
133Handle<Object> Execution::New(Handle<JSFunction> func, int argc,
134 Object*** args, bool* pending_exception) {
135 return Invoke(true, func, Top::global(), argc, args, pending_exception);
136}
137
138
139Handle<Object> Execution::TryCall(Handle<JSFunction> func,
140 Handle<Object> receiver,
141 int argc,
142 Object*** args,
143 bool* caught_exception) {
144 // Enter a try-block while executing the JavaScript code. To avoid
145 // duplicate error printing it must be non-verbose. Also, to avoid
146 // creating message objects during stack overflow we shouldn't
147 // capture messages.
148 v8::TryCatch catcher;
149 catcher.SetVerbose(false);
150 catcher.SetCaptureMessage(false);
151
152 Handle<Object> result = Invoke(false, func, receiver, argc, args,
153 caught_exception);
154
155 if (*caught_exception) {
156 ASSERT(catcher.HasCaught());
157 ASSERT(Top::has_pending_exception());
158 ASSERT(Top::external_caught_exception());
159 if (Top::pending_exception() == Heap::termination_exception()) {
160 result = Factory::termination_exception();
161 } else {
162 result = v8::Utils::OpenHandle(*catcher.Exception());
163 }
164 Top::OptionalRescheduleException(true);
165 }
166
167 ASSERT(!Top::has_pending_exception());
168 ASSERT(!Top::external_caught_exception());
169 return result;
170}
171
172
173Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
174 ASSERT(!object->IsJSFunction());
175
176 // If you return a function from here, it will be called when an
177 // attempt is made to call the given object as a function.
178
179 // Regular expressions can be called as functions in both Firefox
180 // and Safari so we allow it too.
181 if (object->IsJSRegExp()) {
182 Handle<String> exec = Factory::exec_symbol();
183 return Handle<Object>(object->GetProperty(*exec));
184 }
185
186 // Objects created through the API can have an instance-call handler
187 // that should be used when calling the object as a function.
188 if (object->IsHeapObject() &&
189 HeapObject::cast(*object)->map()->has_instance_call_handler()) {
190 return Handle<JSFunction>(
191 Top::global_context()->call_as_function_delegate());
192 }
193
194 return Factory::undefined_value();
195}
196
197
198Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
199 ASSERT(!object->IsJSFunction());
200
201 // If you return a function from here, it will be called when an
202 // attempt is made to call the given object as a constructor.
203
204 // Objects created through the API can have an instance-call handler
205 // that should be used when calling the object as a function.
206 if (object->IsHeapObject() &&
207 HeapObject::cast(*object)->map()->has_instance_call_handler()) {
208 return Handle<JSFunction>(
209 Top::global_context()->call_as_constructor_delegate());
210 }
211
212 return Factory::undefined_value();
213}
214
215
216// Static state for stack guards.
217StackGuard::ThreadLocal StackGuard::thread_local_;
218
219
220bool StackGuard::IsStackOverflow() {
221 ExecutionAccess access;
222 return (thread_local_.jslimit_ != kInterruptLimit &&
223 thread_local_.climit_ != kInterruptLimit);
224}
225
226
227void StackGuard::EnableInterrupts() {
228 ExecutionAccess access;
229 if (IsSet(access)) {
230 set_limits(kInterruptLimit, access);
231 }
232}
233
234
235void StackGuard::SetStackLimit(uintptr_t limit) {
236 ExecutionAccess access;
237 // If the current limits are special (eg due to a pending interrupt) then
238 // leave them alone.
239 uintptr_t jslimit = SimulatorStack::JsLimitFromCLimit(limit);
240 if (thread_local_.jslimit_ == thread_local_.initial_jslimit_) {
241 thread_local_.jslimit_ = jslimit;
242 Heap::SetStackLimit(jslimit);
243 }
244 if (thread_local_.climit_ == thread_local_.initial_climit_) {
245 thread_local_.climit_ = limit;
246 }
247 thread_local_.initial_climit_ = limit;
248 thread_local_.initial_jslimit_ = jslimit;
249}
250
251
252void StackGuard::DisableInterrupts() {
253 ExecutionAccess access;
254 reset_limits(access);
255}
256
257
258bool StackGuard::IsSet(const ExecutionAccess& lock) {
259 return thread_local_.interrupt_flags_ != 0;
260}
261
262
263bool StackGuard::IsInterrupted() {
264 ExecutionAccess access;
265 return thread_local_.interrupt_flags_ & INTERRUPT;
266}
267
268
269void StackGuard::Interrupt() {
270 ExecutionAccess access;
271 thread_local_.interrupt_flags_ |= INTERRUPT;
272 set_limits(kInterruptLimit, access);
273}
274
275
276bool StackGuard::IsPreempted() {
277 ExecutionAccess access;
278 return thread_local_.interrupt_flags_ & PREEMPT;
279}
280
281
282void StackGuard::Preempt() {
283 ExecutionAccess access;
284 thread_local_.interrupt_flags_ |= PREEMPT;
285 set_limits(kInterruptLimit, access);
286}
287
288
289bool StackGuard::IsTerminateExecution() {
290 ExecutionAccess access;
291 return thread_local_.interrupt_flags_ & TERMINATE;
292}
293
294
295void StackGuard::TerminateExecution() {
296 ExecutionAccess access;
297 thread_local_.interrupt_flags_ |= TERMINATE;
298 set_limits(kInterruptLimit, access);
299}
300
301
302#ifdef ENABLE_DEBUGGER_SUPPORT
303bool StackGuard::IsDebugBreak() {
304 ExecutionAccess access;
305 return thread_local_.interrupt_flags_ & DEBUGBREAK;
306}
307
308
309void StackGuard::DebugBreak() {
310 ExecutionAccess access;
311 thread_local_.interrupt_flags_ |= DEBUGBREAK;
312 set_limits(kInterruptLimit, access);
313}
314
315
316bool StackGuard::IsDebugCommand() {
317 ExecutionAccess access;
318 return thread_local_.interrupt_flags_ & DEBUGCOMMAND;
319}
320
321
322void StackGuard::DebugCommand() {
323 if (FLAG_debugger_auto_break) {
324 ExecutionAccess access;
325 thread_local_.interrupt_flags_ |= DEBUGCOMMAND;
326 set_limits(kInterruptLimit, access);
327 }
328}
329#endif
330
331void StackGuard::Continue(InterruptFlag after_what) {
332 ExecutionAccess access;
333 thread_local_.interrupt_flags_ &= ~static_cast<int>(after_what);
334 if (thread_local_.interrupt_flags_ == 0) {
335 reset_limits(access);
336 }
337}
338
339
340int StackGuard::ArchiveSpacePerThread() {
341 return sizeof(ThreadLocal);
342}
343
344
345char* StackGuard::ArchiveStackGuard(char* to) {
346 ExecutionAccess access;
347 memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
348 ThreadLocal blank;
349 thread_local_ = blank;
350 return to + sizeof(ThreadLocal);
351}
352
353
354char* StackGuard::RestoreStackGuard(char* from) {
355 ExecutionAccess access;
356 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
357 Heap::SetStackLimit(thread_local_.jslimit_);
358 return from + sizeof(ThreadLocal);
359}
360
361
362static internal::Thread::LocalStorageKey stack_limit_key =
363 internal::Thread::CreateThreadLocalKey();
364
365
366void StackGuard::FreeThreadResources() {
367 Thread::SetThreadLocal(
368 stack_limit_key,
369 reinterpret_cast<void*>(thread_local_.initial_climit_));
370}
371
372
373void StackGuard::ThreadLocal::Clear() {
374 initial_jslimit_ = kIllegalLimit;
375 jslimit_ = kIllegalLimit;
376 initial_climit_ = kIllegalLimit;
377 climit_ = kIllegalLimit;
378 nesting_ = 0;
379 postpone_interrupts_nesting_ = 0;
380 interrupt_flags_ = 0;
381 Heap::SetStackLimit(kIllegalLimit);
382}
383
384
385void StackGuard::ThreadLocal::Initialize() {
386 if (initial_climit_ == kIllegalLimit) {
387 // Takes the address of the limit variable in order to find out where
388 // the top of stack is right now.
Steve Block3ce2e202009-11-05 08:53:23 +0000389 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit) - kLimitSize;
390 ASSERT(reinterpret_cast<uintptr_t>(&limit) > kLimitSize);
Steve Blocka7e24c12009-10-30 11:49:00 +0000391 initial_jslimit_ = SimulatorStack::JsLimitFromCLimit(limit);
392 jslimit_ = SimulatorStack::JsLimitFromCLimit(limit);
393 initial_climit_ = limit;
394 climit_ = limit;
395 Heap::SetStackLimit(SimulatorStack::JsLimitFromCLimit(limit));
396 }
397 nesting_ = 0;
398 postpone_interrupts_nesting_ = 0;
399 interrupt_flags_ = 0;
400}
401
402
403void StackGuard::ClearThread(const ExecutionAccess& lock) {
404 thread_local_.Clear();
405}
406
407
408void StackGuard::InitThread(const ExecutionAccess& lock) {
409 thread_local_.Initialize();
410 void* stored_limit = Thread::GetThreadLocal(stack_limit_key);
411 // You should hold the ExecutionAccess lock when you call this.
412 if (stored_limit != NULL) {
413 StackGuard::SetStackLimit(reinterpret_cast<intptr_t>(stored_limit));
414 }
415}
416
417
418// --- C a l l s t o n a t i v e s ---
419
420#define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \
421 do { \
422 Object** args[argc] = argv; \
423 ASSERT(has_pending_exception != NULL); \
424 return Call(Top::name##_fun(), Top::builtins(), argc, args, \
425 has_pending_exception); \
426 } while (false)
427
428
429Handle<Object> Execution::ToBoolean(Handle<Object> obj) {
430 // See the similar code in runtime.js:ToBoolean.
431 if (obj->IsBoolean()) return obj;
432 bool result = true;
433 if (obj->IsString()) {
434 result = Handle<String>::cast(obj)->length() != 0;
435 } else if (obj->IsNull() || obj->IsUndefined()) {
436 result = false;
437 } else if (obj->IsNumber()) {
438 double value = obj->Number();
439 result = !((value == 0) || isnan(value));
440 }
441 return Handle<Object>(Heap::ToBoolean(result));
442}
443
444
445Handle<Object> Execution::ToNumber(Handle<Object> obj, bool* exc) {
446 RETURN_NATIVE_CALL(to_number, 1, { obj.location() }, exc);
447}
448
449
450Handle<Object> Execution::ToString(Handle<Object> obj, bool* exc) {
451 RETURN_NATIVE_CALL(to_string, 1, { obj.location() }, exc);
452}
453
454
455Handle<Object> Execution::ToDetailString(Handle<Object> obj, bool* exc) {
456 RETURN_NATIVE_CALL(to_detail_string, 1, { obj.location() }, exc);
457}
458
459
460Handle<Object> Execution::ToObject(Handle<Object> obj, bool* exc) {
461 if (obj->IsJSObject()) return obj;
462 RETURN_NATIVE_CALL(to_object, 1, { obj.location() }, exc);
463}
464
465
466Handle<Object> Execution::ToInteger(Handle<Object> obj, bool* exc) {
467 RETURN_NATIVE_CALL(to_integer, 1, { obj.location() }, exc);
468}
469
470
471Handle<Object> Execution::ToUint32(Handle<Object> obj, bool* exc) {
472 RETURN_NATIVE_CALL(to_uint32, 1, { obj.location() }, exc);
473}
474
475
476Handle<Object> Execution::ToInt32(Handle<Object> obj, bool* exc) {
477 RETURN_NATIVE_CALL(to_int32, 1, { obj.location() }, exc);
478}
479
480
481Handle<Object> Execution::NewDate(double time, bool* exc) {
482 Handle<Object> time_obj = Factory::NewNumber(time);
483 RETURN_NATIVE_CALL(create_date, 1, { time_obj.location() }, exc);
484}
485
486
487#undef RETURN_NATIVE_CALL
488
489
490Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) {
491 int int_index = static_cast<int>(index);
492 if (int_index < 0 || int_index >= string->length()) {
493 return Factory::undefined_value();
494 }
495
496 Handle<Object> char_at =
497 GetProperty(Top::builtins(), Factory::char_at_symbol());
498 if (!char_at->IsJSFunction()) {
499 return Factory::undefined_value();
500 }
501
502 bool caught_exception;
503 Handle<Object> index_object = Factory::NewNumberFromInt(int_index);
504 Object** index_arg[] = { index_object.location() };
505 Handle<Object> result = TryCall(Handle<JSFunction>::cast(char_at),
506 string,
507 ARRAY_SIZE(index_arg),
508 index_arg,
509 &caught_exception);
510 if (caught_exception) {
511 return Factory::undefined_value();
512 }
513 return result;
514}
515
516
517Handle<JSFunction> Execution::InstantiateFunction(
518 Handle<FunctionTemplateInfo> data, bool* exc) {
519 // Fast case: see if the function has already been instantiated
520 int serial_number = Smi::cast(data->serial_number())->value();
521 Object* elm =
522 Top::global_context()->function_cache()->GetElement(serial_number);
523 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
524 // The function has not yet been instantiated in this context; do it.
525 Object** args[1] = { Handle<Object>::cast(data).location() };
526 Handle<Object> result =
527 Call(Top::instantiate_fun(), Top::builtins(), 1, args, exc);
528 if (*exc) return Handle<JSFunction>::null();
529 return Handle<JSFunction>::cast(result);
530}
531
532
533Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data,
534 bool* exc) {
535 if (data->property_list()->IsUndefined() &&
536 !data->constructor()->IsUndefined()) {
537 // Initialization to make gcc happy.
538 Object* result = NULL;
539 {
540 HandleScope scope;
541 Handle<FunctionTemplateInfo> cons_template =
542 Handle<FunctionTemplateInfo>(
543 FunctionTemplateInfo::cast(data->constructor()));
544 Handle<JSFunction> cons = InstantiateFunction(cons_template, exc);
545 if (*exc) return Handle<JSObject>::null();
546 Handle<Object> value = New(cons, 0, NULL, exc);
547 if (*exc) return Handle<JSObject>::null();
548 result = *value;
549 }
550 ASSERT(!*exc);
551 return Handle<JSObject>(JSObject::cast(result));
552 } else {
553 Object** args[1] = { Handle<Object>::cast(data).location() };
554 Handle<Object> result =
555 Call(Top::instantiate_fun(), Top::builtins(), 1, args, exc);
556 if (*exc) return Handle<JSObject>::null();
557 return Handle<JSObject>::cast(result);
558 }
559}
560
561
562void Execution::ConfigureInstance(Handle<Object> instance,
563 Handle<Object> instance_template,
564 bool* exc) {
565 Object** args[2] = { instance.location(), instance_template.location() };
566 Execution::Call(Top::configure_instance_fun(), Top::builtins(), 2, args, exc);
567}
568
569
570Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
571 Handle<JSFunction> fun,
572 Handle<Object> pos,
573 Handle<Object> is_global) {
574 const int argc = 4;
575 Object** args[argc] = { recv.location(),
576 Handle<Object>::cast(fun).location(),
577 pos.location(),
578 is_global.location() };
579 bool caught_exception = false;
580 Handle<Object> result = TryCall(Top::get_stack_trace_line_fun(),
581 Top::builtins(), argc, args,
582 &caught_exception);
583 if (caught_exception || !result->IsString()) return Factory::empty_symbol();
584 return Handle<String>::cast(result);
585}
586
587
588static Object* RuntimePreempt() {
589 // Clear the preempt request flag.
590 StackGuard::Continue(PREEMPT);
591
592 ContextSwitcher::PreemptionReceived();
593
594#ifdef ENABLE_DEBUGGER_SUPPORT
595 if (Debug::InDebugger()) {
596 // If currently in the debugger don't do any actual preemption but record
597 // that preemption occoured while in the debugger.
598 Debug::PreemptionWhileInDebugger();
599 } else {
600 // Perform preemption.
601 v8::Unlocker unlocker;
602 Thread::YieldCPU();
603 }
604#else
605 // Perform preemption.
606 v8::Unlocker unlocker;
607 Thread::YieldCPU();
608#endif
609
610 return Heap::undefined_value();
611}
612
613
614#ifdef ENABLE_DEBUGGER_SUPPORT
615Object* Execution::DebugBreakHelper() {
616 // Just continue if breaks are disabled.
617 if (Debug::disable_break()) {
618 return Heap::undefined_value();
619 }
620
621 {
622 JavaScriptFrameIterator it;
623 ASSERT(!it.done());
624 Object* fun = it.frame()->function();
625 if (fun && fun->IsJSFunction()) {
626 // Don't stop in builtin functions.
627 if (JSFunction::cast(fun)->IsBuiltin()) {
628 return Heap::undefined_value();
629 }
630 GlobalObject* global = JSFunction::cast(fun)->context()->global();
631 // Don't stop in debugger functions.
632 if (Debug::IsDebugGlobal(global)) {
633 return Heap::undefined_value();
634 }
635 }
636 }
637
638 // Collect the break state before clearing the flags.
639 bool debug_command_only =
640 StackGuard::IsDebugCommand() && !StackGuard::IsDebugBreak();
641
642 // Clear the debug request flags.
643 StackGuard::Continue(DEBUGBREAK);
644 StackGuard::Continue(DEBUGCOMMAND);
645
646 HandleScope scope;
647 // Enter the debugger. Just continue if we fail to enter the debugger.
648 EnterDebugger debugger;
649 if (debugger.FailedToEnter()) {
650 return Heap::undefined_value();
651 }
652
653 // Notify the debug event listeners. Indicate auto continue if the break was
654 // a debug command break.
655 Debugger::OnDebugBreak(Factory::undefined_value(), debug_command_only);
656
657 // Return to continue execution.
658 return Heap::undefined_value();
659}
660#endif
661
662Object* Execution::HandleStackGuardInterrupt() {
663#ifdef ENABLE_DEBUGGER_SUPPORT
664 if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) {
665 DebugBreakHelper();
666 }
667#endif
668 if (StackGuard::IsPreempted()) RuntimePreempt();
669 if (StackGuard::IsTerminateExecution()) {
670 StackGuard::Continue(TERMINATE);
671 return Top::TerminateExecution();
672 }
673 if (StackGuard::IsInterrupted()) {
674 // interrupt
675 StackGuard::Continue(INTERRUPT);
676 return Top::StackOverflow();
677 }
678 return Heap::undefined_value();
679}
680
681// --- G C E x t e n s i o n ---
682
683const char* GCExtension::kSource = "native function gc();";
684
685
686v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunction(
687 v8::Handle<v8::String> str) {
688 return v8::FunctionTemplate::New(GCExtension::GC);
689}
690
691
692v8::Handle<v8::Value> GCExtension::GC(const v8::Arguments& args) {
693 // All allocation spaces other than NEW_SPACE have the same effect.
694 Heap::CollectAllGarbage(false);
695 return v8::Undefined();
696}
697
698
699static GCExtension kGCExtension;
700v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension);
701
702} } // namespace v8::internal