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

Side by Side Diff: src/api.cc

Issue 38993005: Add isolate parameter to SetResourceConstraints, and deprecate version which depends on current iso… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update comment too. Created 7 years, 1 month 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 | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 ResourceConstraints::ResourceConstraints() 562 ResourceConstraints::ResourceConstraints()
563 : max_young_space_size_(0), 563 : max_young_space_size_(0),
564 max_old_space_size_(0), 564 max_old_space_size_(0),
565 max_executable_size_(0), 565 max_executable_size_(0),
566 stack_limit_(NULL) { } 566 stack_limit_(NULL) { }
567 567
568 568
569 bool SetResourceConstraints(ResourceConstraints* constraints) { 569 bool SetResourceConstraints(ResourceConstraints* constraints) {
570 i::Isolate* isolate = EnterIsolateIfNeeded(); 570 i::Isolate* isolate = EnterIsolateIfNeeded();
571 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate),
572 constraints);
573 }
571 574
575
576 bool SetResourceConstraints(Isolate* v8_isolate,
577 ResourceConstraints* constraints) {
578 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
572 int young_space_size = constraints->max_young_space_size(); 579 int young_space_size = constraints->max_young_space_size();
573 int old_gen_size = constraints->max_old_space_size(); 580 int old_gen_size = constraints->max_old_space_size();
574 int max_executable_size = constraints->max_executable_size(); 581 int max_executable_size = constraints->max_executable_size();
575 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { 582 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
576 // After initialization it's too late to change Heap constraints. 583 // After initialization it's too late to change Heap constraints.
577 ASSERT(!isolate->IsInitialized()); 584 ASSERT(!isolate->IsInitialized());
578 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, 585 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2,
579 old_gen_size, 586 old_gen_size,
580 max_executable_size); 587 max_executable_size);
581 if (!result) return false; 588 if (!result) return false;
(...skipping 6988 matching lines...) Expand 10 before | Expand all | Expand 10 after
7570 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7577 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7571 Address callback_address = 7578 Address callback_address =
7572 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7579 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7573 VMState<EXTERNAL> state(isolate); 7580 VMState<EXTERNAL> state(isolate);
7574 ExternalCallbackScope call_scope(isolate, callback_address); 7581 ExternalCallbackScope call_scope(isolate, callback_address);
7575 callback(info); 7582 callback(info);
7576 } 7583 }
7577 7584
7578 7585
7579 } } // namespace v8::internal 7586 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698